generalized config variable check
This commit is contained in:
parent
959f57ffc5
commit
250ead165b
1 changed files with 12 additions and 9 deletions
|
@ -1,17 +1,20 @@
|
||||||
const config = require('config');
|
const config = require('config');
|
||||||
const logger = require('winston');
|
const logger = require('winston');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
module.exports = function () {
|
module.exports = function () {
|
||||||
let configVars = [];
|
// get the config file
|
||||||
configVars.push(config.get('Logging'));
|
const defaultConfigFile = JSON.parse(fs.readFileSync('./config/default.json'));
|
||||||
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 configCategoryKey in defaultConfigFile) {
|
||||||
for (let key in configVars[i]) {
|
if (defaultConfigFile.hasOwnProperty(configCategoryKey)) {
|
||||||
if (configVars[i].hasOwnProperty(key)) {
|
// get the final variables for each config category
|
||||||
logger.debug(`CONFIG CHECK: ${key} === ${configVars[i][key]}`);
|
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]}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue