feat(server): added a missing db prevention crash
This commit is contained in:
@@ -17,11 +17,18 @@ import sqlService from "./services/sqlServer/sqlService.js";
|
|||||||
import logistics from "./services/logistics/logisticsService.js";
|
import logistics from "./services/logistics/logisticsService.js";
|
||||||
import {db} from "../database/dbclient.js";
|
import {db} from "../database/dbclient.js";
|
||||||
import {settings} from "../database/schema/settings.js";
|
import {settings} from "../database/schema/settings.js";
|
||||||
import {eq} from "drizzle-orm";
|
import {count, eq} from "drizzle-orm";
|
||||||
|
|
||||||
|
// create the main prodlogin here
|
||||||
|
const username = "lst_user";
|
||||||
|
const password = "Alpla$$Prod";
|
||||||
|
export const lstAuth = btoa(`${username}:${password}`);
|
||||||
|
|
||||||
|
// checking to make sure we have the settings intialized
|
||||||
|
const serverIntialized = await db.select({count: count()}).from(settings);
|
||||||
|
export const installed = serverIntialized[0].count === 0 && process.env.NODE_ENV !== "development" ? false : true;
|
||||||
|
createLog("info", "LST", "server", `Server is installed: ${installed}`);
|
||||||
|
|
||||||
// plant token
|
|
||||||
const dbServer = await db.select().from(settings).where(eq(settings.name, "dbServer"));
|
|
||||||
const serverPort = await db.select().from(settings).where(eq(settings.name, "serverPort"));
|
|
||||||
const allowedOrigins = [
|
const allowedOrigins = [
|
||||||
"http://localhost:3000",
|
"http://localhost:3000",
|
||||||
"http://localhost:4000",
|
"http://localhost:4000",
|
||||||
|
|||||||
Reference in New Issue
Block a user