1
0
mirror of https://github.com/dap-ps/discover.git synced 2025-01-31 11:35:18 +00:00
discover/back-end/config/db-config.js
Jakub Sokołowski f7c0be8eb6
add config/index.js for central config management
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2019-08-05 12:36:32 -04:00

16 lines
405 B
JavaScript

let mongoose = require('mongoose');
const config = require('./');
class DBConfig {
static config() {
if (config.DB_CONNECTION == undefined) {
throw Error('Unable to find MongoDB URI in DB_CONNECTION env variable!')
}
mongoose.Promise = global.Promise;
mongoose.connect(config.DB_CONNECTION, { useNewUrlParser: true });
}
}
module.exports = DBConfig;