Restructuring the Project
Updating dependencies
This commit is contained in:
13
Backend/src/database.ts
Normal file
13
Backend/src/database.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import SafeMongo from "@hibas123/safe_mongo";
|
||||
import Config from "./config";
|
||||
let dbname = "openauth";
|
||||
let host = "localhost";
|
||||
if (Config.database) {
|
||||
if (Config.database.database) dbname = Config.database.database;
|
||||
if (Config.database.host) host = Config.database.host;
|
||||
}
|
||||
if (Config.core.dev) dbname += "_dev";
|
||||
const DB = new SafeMongo("mongodb://" + host, dbname, {
|
||||
useUnifiedTopology: true,
|
||||
});
|
||||
export default DB;
|
Reference in New Issue
Block a user