mirror of
https://github.com/dap-ps/discover.git
synced 2025-01-31 11:35:18 +00:00
16 lines
405 B
JavaScript
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;
|