refactor(sql server): changes to look at localhost if in production
This commit is contained in:
@@ -34,7 +34,9 @@ export const initializeProdPool = async () => {
|
||||
(n: any) => n.name === "dbServer",
|
||||
) as any;
|
||||
|
||||
const serverUp = await checkHostnamePort(`${dbServer[0].value}:1433`);
|
||||
const serverUp = await checkHostnamePort(
|
||||
`${process.env.NODE_ENV !== "development" ? "localhost" : dbServer[0].value}:1433`,
|
||||
);
|
||||
|
||||
if (!serverUp) {
|
||||
createLog(
|
||||
@@ -88,7 +90,7 @@ export const initializeProdPool = async () => {
|
||||
}
|
||||
try {
|
||||
const config = await prodSqlConfig();
|
||||
pool = new sql.ConnectionPool(config!)
|
||||
pool = new sql.ConnectionPool(config!);
|
||||
await pool.connect();
|
||||
|
||||
createLog(
|
||||
@@ -165,7 +167,9 @@ export async function query(queryToRun: string, name: string) {
|
||||
const dbServer = serverSettings.filter(
|
||||
(n: any) => n.name === "dbServer",
|
||||
) as any;
|
||||
const serverUp = await checkHostnamePort(`${dbServer[0].value}:1433`);
|
||||
const serverUp = await checkHostnamePort(
|
||||
`${process.env.NODE_ENV !== "development" ? "localhost" : dbServer[0].value}:1433`,
|
||||
);
|
||||
|
||||
if (!serverUp) {
|
||||
createLog(
|
||||
|
||||
Reference in New Issue
Block a user