only load dotenv if development environment
This commit is contained in:
parent
145c563171
commit
79f8ca8d85
|
@ -4,7 +4,9 @@
|
|||
*/
|
||||
|
||||
//Load ENV vars from .env
|
||||
require('dotenv').config();
|
||||
if ((process.env.NODE_ENV || 'development') === 'development') {
|
||||
require('dotenv').config();
|
||||
}
|
||||
|
||||
var init = require('./config/init')(),
|
||||
config = require('./config/config'),
|
||||
|
@ -18,13 +20,13 @@ var init = require('./config/init')(),
|
|||
*/
|
||||
|
||||
// Bootstrap db connection
|
||||
var db = mongoose.connect(config.db.uri, config.db.options, function(err) {
|
||||
var db = mongoose.connect(config.db.uri, config.db.options, function (err) {
|
||||
if (err) {
|
||||
console.error(chalk.red('Could not connect to MongoDB!'));
|
||||
console.log(chalk.red(err));
|
||||
}
|
||||
});
|
||||
mongoose.connection.on('error', function(err) {
|
||||
mongoose.connection.on('error', function (err) {
|
||||
console.error(chalk.red('MongoDB connection error: ' + err));
|
||||
process.exit(-1);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue