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

16 lines
405 B
JavaScript
Raw Normal View History

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