hardened configuration

- moved env rewrite + dotenv code to single location
- fixed bug with system flag on user
This commit is contained in:
Wyatt Johnson
2018-01-05 16:06:36 -07:00
parent 6260339508
commit c07ec23a20
18 changed files with 70 additions and 52 deletions
+11
View File
@@ -0,0 +1,11 @@
// Perform rewrites to the runtime environment variables based on the contents
// of the process.env.REWRITE_ENV if it exists. This is done here as it is the
// entrypoint for the entire applications configuration.
require('env-rewrite').rewrite();
if (process.env.NODE_ENV !== 'test') {
// Apply all the configuration provided in the .env file if it isn't already
// in the environment.
require('dotenv').config();
}
+5 -5
View File
@@ -1,14 +1,14 @@
const mongoose = require('mongoose');
const debug = require('debug')('talk:db');
const enabled = require('debug').enabled;
const queryDebugger = require('debug')('talk:db:query');
const {
MONGO_URL,
WEBPACK,
CREATE_MONGO_INDEXES,
} = require('../config');
const mongoose = require('mongoose');
const debug = require('debug')('talk:db');
const enabled = require('debug').enabled;
const queryDebugger = require('debug')('talk:db:query');
// Loading the formatter from Mongoose:
//
// https://github.com/Automattic/mongoose/blob/1a93d1f4d12e441e17ddf451e96fbc5f6e8f54b8/lib/drivers/node-mongodb-native/collection.js#L182