Skip to content

Commit

Permalink
Conditionally set Mongo to debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jurkian committed Nov 14, 2019
1 parent 730fdf0 commit 9d3593e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions api/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ require('dotenv').config();

let CONFIG = {};

// Current ENV
CONFIG.current_env = process.env.CURRENT_ENV || 'production';

// Port
CONFIG.port = process.env.PORT || '3001';

Expand Down
5 changes: 4 additions & 1 deletion api/db/mongoose.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const CONFIG = require('@config/config');
const mongoose = require('mongoose');
const mongoose = require('mongoose').set(
'debug',
CONFIG.current_env === 'development' ? true : false
);
const chalk = require('chalk');

mongoose.connect(`${CONFIG.mongodb_uri}`, {
Expand Down

0 comments on commit 9d3593e

Please sign in to comment.