|
@ -11,8 +11,10 @@ function sanitizeConfig(config, fields=[]) { |
|
|
return clonedConfig; |
|
|
return clonedConfig; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function getConfig(configFile, sanitizedFields=[]) { |
|
|
|
|
|
if (!loadedConfigs.has(configFile)) { |
|
|
|
|
|
|
|
|
function getConfig(configFile, sanitizedFields=[], reload=false) { |
|
|
|
|
|
if (loadedConfigs.has(configFile) && !reload) { |
|
|
|
|
|
return loadedConfigs.get(configFile); |
|
|
|
|
|
} else { |
|
|
logger.info("Reading config: %s", configFile); |
|
|
logger.info("Reading config: %s", configFile); |
|
|
let rawConfigData = fs.readFileSync(configFile); |
|
|
let rawConfigData = fs.readFileSync(configFile); |
|
|
let config = JSON.parse(rawConfigData); |
|
|
let config = JSON.parse(rawConfigData); |
|
@ -20,8 +22,6 @@ function getConfig(configFile, sanitizedFields=[]) { |
|
|
logger.debug("%o", sanitizeConfig(config, sanitizedFields)); |
|
|
logger.debug("%o", sanitizeConfig(config, sanitizedFields)); |
|
|
loadedConfigs.set(configFile, config); |
|
|
loadedConfigs.set(configFile, config); |
|
|
return config; |
|
|
return config; |
|
|
} else { |
|
|
|
|
|
return loadedConfigs.get(configFile); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|