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