refactor(sql): full changes to localhost if on produciton server

This commit is contained in:
2026-02-16 09:39:35 -06:00
parent 914ad46c43
commit ec201fcfb5

View File

@@ -10,16 +10,15 @@ export const prodSqlConfig = async () => {
// create dummy type data // create dummy type data
const server = serverSetting.filter((s: any) => s.name === "dbServer"); const server = serverSetting.filter((s: any) => s.name === "dbServer");
const plantToken = serverSetting.filter( const plantToken = serverSetting.filter(
(s: any) => s.name === "plantToken" (s: any) => s.name === "plantToken",
); );
const dbUser = serverSetting.filter((s: any) => s.name === "dbUser"); const dbUser = serverSetting.filter((s: any) => s.name === "dbUser");
// if erroring out double check the password was actually encoded before saving // if erroring out double check the password was actually encoded before saving
const dbPassword = serverSetting.filter( const dbPassword = serverSetting.filter((s: any) => s.name === "dbPass");
(s: any) => s.name === "dbPass"
);
const sqlConfig = { const sqlConfig = {
server: server[0].value, server:
process.env.NODE_ENV !== "development" ? "localhost" : server[0].value,
database: `AlplaPROD_${plantToken[0].value}_cus`, database: `AlplaPROD_${plantToken[0].value}_cus`,
user: dbUser[0].value, user: dbUser[0].value,
password: atob(dbPassword[0].value), password: atob(dbPassword[0].value),
@@ -44,8 +43,8 @@ export const prodSqlConfig = async () => {
"lst", "lst",
"sqlProd", "sqlProd",
`${JSON.stringify( `${JSON.stringify(
error error,
)} "There was an error getting/setting up the config for the prod sql server."` )} "There was an error getting/setting up the config for the prod sql server."`,
); );
} }
}; };