added config variable check on startup

This commit is contained in:
bill bittner 2017-09-25 09:13:18 -07:00
parent 7d0fda64f7
commit 959f57ffc5
2 changed files with 22 additions and 1 deletions

18
helpers/configVarCheck.js Normal file
View file

@ -0,0 +1,18 @@
const config = require('config');
const logger = require('winston');
module.exports = function () {
let configVars = [];
configVars.push(config.get('Logging'));
configVars.push(config.get('Database'));
configVars.push(config.get('AnalyticsConfig'));
configVars.push(config.get('WalletConfig'));
for (let i = 0; i < configVars.length; i++) {
for (let key in configVars[i]) {
if (configVars[i].hasOwnProperty(key)) {
logger.debug(`CONFIG CHECK: ${key} === ${configVars[i][key]}`);
}
}
}
};

View file

@ -20,6 +20,9 @@ const logLevel = config.get('Logging.LogLevel');
require('./config/loggerConfig.js')(logger, logLevel);
require('./config/slackLoggerConfig.js')(logger);
// check for global config variables
require('./helpers/configVarCheck.js')();
// trust the proxy to get ip address for us
app.enable('trust proxy');
@ -68,7 +71,7 @@ const hbs = expressHandlebars.create({
app.engine('handlebars', hbs.engine);
app.set('view engine', 'handlebars');
// middleware to pass user info back to client, if user is logged in
// middleware to pass user info back to client (for handlebars access), if user is logged in
app.use((req, res, next) => {
if (req.user) {
res.locals.user = {