spee.ch/helpers/configVarCheck.js

22 lines
763 B
JavaScript
Raw Normal View History

2017-09-25 18:13:18 +02:00
const config = require('config');
const logger = require('winston');
2017-09-25 18:31:26 +02:00
const fs = require('fs');
2017-09-25 18:13:18 +02:00
module.exports = function () {
2017-09-25 18:31:26 +02:00
// get the config file
const defaultConfigFile = JSON.parse(fs.readFileSync('./config/default.json'));
2017-09-25 18:13:18 +02:00
2017-09-25 18:31:26 +02:00
for (let configCategoryKey in defaultConfigFile) {
if (defaultConfigFile.hasOwnProperty(configCategoryKey)) {
// get the final variables for each config category
const configVariables = config.get(configCategoryKey);
for (let configVarKey in configVariables) {
if (configVariables.hasOwnProperty(configVarKey)) {
// print each variable
logger.debug(`CONFIG CHECK: ${configCategoryKey}.${configVarKey} === ${configVariables[configVarKey]}`);
}
2017-09-25 18:13:18 +02:00
}
}
}
};