fix(server): updated secret rotation to pick on db host in validation

This commit is contained in:
Akhil Mohan
2024-03-19 13:56:21 +00:00
parent 77d068ae2c
commit cb828200e1
3 changed files with 14 additions and 1 deletions
+11
View File
@@ -0,0 +1,11 @@
import { URL } from "url"; // Import the URL class
export const getDbConnectionHost = (urlString: string) => {
try {
const url = new URL(urlString);
// Split hostname and port (if provided)
return url.hostname.split(":")[0];
} catch (error) {
return null;
}
};
+1
View File
@@ -4,6 +4,7 @@ import { Tables } from "knex/types/tables";
import { DatabaseError } from "../errors";
export * from "./connection";
export * from "./join";
export * from "./select";