|
@ -3,7 +3,7 @@ let { logger } = require('./logging'); |
|
|
|
|
|
|
|
|
let loadedConfigs = new Map(); |
|
|
let loadedConfigs = new Map(); |
|
|
|
|
|
|
|
|
function sanitizeConfig(config, fields = []) { |
|
|
|
|
|
|
|
|
function sanitizeConfig(config: any, fields = []) : any { |
|
|
let clonedConfig = { ...config }; |
|
|
let clonedConfig = { ...config }; |
|
|
fields.forEach((field) => { |
|
|
fields.forEach((field) => { |
|
|
clonedConfig[field] = '******' |
|
|
clonedConfig[field] = '******' |
|
@ -11,7 +11,7 @@ function sanitizeConfig(config, fields = []) { |
|
|
return clonedConfig; |
|
|
return clonedConfig; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function getConfig(configFile, sanitizedFields = [], reload = false) { |
|
|
|
|
|
|
|
|
function getConfig(configFile: String, sanitizedFields: Array<String> = [], reload: Boolean = false) : any { |
|
|
if (loadedConfigs.has(configFile) && !reload) { |
|
|
if (loadedConfigs.has(configFile) && !reload) { |
|
|
return loadedConfigs.get(configFile); |
|
|
return loadedConfigs.get(configFile); |
|
|
} else { |
|
|
} else { |
|
@ -25,5 +25,5 @@ function getConfig(configFile, sanitizedFields = [], reload = false) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
exports.getConfig = getConfig; |
|
|
|
|
|
exports.sanitizeConfig = sanitizeConfig; |
|
|
|
|
|
|
|
|
export { getConfig }; |
|
|
|
|
|
export { sanitizeConfig }; |