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());
|
||||
}
|
||||
|
||||
if (isProduction) {
|
||||
mongoose.connect('mongodb://localhost/obs');
|
||||
} else {
|
||||
mongoose.connect('mongodb://localhost/obsTest');
|
||||
mongoose.set('debug', true);
|
||||
}
|
||||
const mongodbUrl = process.env.MONGODB_URL || (isProduction ? 'mongodb://localhost/obs' : 'mongodb://localhost/obsTest')
|
||||
mongoose.connect(mongodbUrl);
|
||||
mongoose.set('debug', !isProduction);
|
||||
|
||||
require('./models/TrackData');
|
||||
require('./models/User');
|
||||
|
|
Loading…
Reference in a new issue