From a0ca4059e91a62864a7a93f063bbb0681de61bb9 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: Mon, 25 Sep 2023 19:54:05 -0400 Subject: [PATCH] refactor: create importable database config --- lib/dbconfig.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 lib/dbconfig.ts diff --git a/lib/dbconfig.ts b/lib/dbconfig.ts new file mode 100644 index 0000000..063c609 --- /dev/null +++ b/lib/dbconfig.ts @@ -0,0 +1,10 @@ +import * as dotenv from "dotenv"; +dotenv.config({path: "../"}) +console.log("in dbconfig", process.env.NODE_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`