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",
|
(n: any) => n.name === "dbServer",
|
||||||
) as any;
|
) 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) {
|
if (!serverUp) {
|
||||||
createLog(
|
createLog(
|
||||||
@@ -88,7 +90,7 @@ export const initializeProdPool = async () => {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const config = await prodSqlConfig();
|
const config = await prodSqlConfig();
|
||||||
pool = new sql.ConnectionPool(config!)
|
pool = new sql.ConnectionPool(config!);
|
||||||
await pool.connect();
|
await pool.connect();
|
||||||
|
|
||||||
createLog(
|
createLog(
|
||||||
@@ -165,7 +167,9 @@ export async function query(queryToRun: string, name: string) {
|
|||||||
const dbServer = serverSettings.filter(
|
const dbServer = serverSettings.filter(
|
||||||
(n: any) => n.name === "dbServer",
|
(n: any) => n.name === "dbServer",
|
||||||
) as any;
|
) 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) {
|
if (!serverUp) {
|
||||||
createLog(
|
createLog(
|
||||||
|
|||||||
Reference in New Issue
Block a user