OpenAuth_server/src/database.ts
2019-12-16 14:02:51 +01:00

11 lines
396 B
TypeScript

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);
export default DB;