feat: allow setting mongodb url through MONGODB_URL environment variable
This commit is contained in:
parent
a618eeffeb
commit
6ff0c4fb21
9
app.js
9
app.js
|
@ -30,12 +30,9 @@ if (!isProduction) {
|
||||||
app.use(errorhandler());
|
app.use(errorhandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isProduction) {
|
const mongodbUrl = process.env.MONGODB_URL || (isProduction ? 'mongodb://localhost/obs' : 'mongodb://localhost/obsTest')
|
||||||
mongoose.connect('mongodb://localhost/obs');
|
mongoose.connect(mongodbUrl);
|
||||||
} else {
|
mongoose.set('debug', !isProduction);
|
||||||
mongoose.connect('mongodb://localhost/obsTest');
|
|
||||||
mongoose.set('debug', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
require('./models/TrackData');
|
require('./models/TrackData');
|
||||||
require('./models/User');
|
require('./models/User');
|
||||||
|
|
Loading…
Reference in a new issue