From 9f180a4d30d9829d8c28c41cdec133478871d043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Thu, 12 Oct 2023 23:04:25 -0400 Subject: [PATCH] refactor: create a constant to hold path to `.env` file (this is temporary) --- REVERT THIS --- --- lib/dbconfig.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/dbconfig.ts b/lib/dbconfig.ts index 063c609..569786d 100644 --- a/lib/dbconfig.ts +++ b/lib/dbconfig.ts @@ -1,10 +1,13 @@ +import { resolve } from "path"; import * as dotenv from "dotenv"; -dotenv.config({path: "../"}) -console.log("in dbconfig", process.env.NODE_ENV) +const FUCKYOU = "/rockfic/abc-rockfic-v3"; +dotenv.config({ path: resolve(FUCKYOU, ".env") }); export const hasMigrated = false; -export const uri = (process.env.NODE_ENV == "development") ? - `mongodb://127.0.0.1/test?authSource=admin` : - `mongodb://${process.env.DBUSER}:${process.env.DBPASS}@${process.env.DB}?authSource=admin` -export const olduri = (process.env.NODE_ENV == "development") ? -`mongodb://127.0.0.1/rockfic_old?authSource=admin` : -`mongodb://${process.env.DBUSER}:${process.env.DBPASS}@127.0.0.1/rockfic_old?authSource=admin` +export const uri = + process.env.NODE_ENV == "development" + ? `mongodb://127.0.0.1/test?authSource=admin` + : `mongodb://${process.env.DBUSER}:${process.env.DBPASS}@${process.env.DB}?authSource=admin`; +export const olduri = + process.env.NODE_ENV == "development" + ? `mongodb://127.0.0.1/rockfic_old?authSource=admin` + : `mongodb://${process.env.DBUSER}:${process.env.DBPASS}@127.0.0.1/rockfic_old?authSource=admin`;