OpenAuth_server/src/database.ts

12 lines
401 B
TypeScript
Raw Normal View History

2019-12-16 13:02:51 +00:00
import SafeMongo from "@hibas123/safe_mongo";
2020-08-07 14:16:39 +00:00
import Config from "./config";
let dbname = "openauth";
let host = "localhost";
2019-12-16 13:02:51 +00:00
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);
2020-08-07 14:16:39 +00:00
export default DB;