refactor: create importable database config

This commit is contained in:
parent 421a283d6c
commit a0ca4059e9
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

10
lib/dbconfig.ts Normal file

@ -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`