Allow JSON array and objects in env.var configs
| @@ -65,7 +65,9 @@ export function getConfigValue(key, defaultValue = null, typeConverter = null) { | ||
| 65 | 65 | function _getValue() { |
| 66 | 66 | const envKey = keyToEnv(key); |
| 67 | 67 | if (envKey in process.env) { |
| 68 | - return process.env[envKey]; | |
| 68 | + const needsJsonParse = defaultValue && typeof defaultValue === 'object'; | |
| 69 | + const envValue = process.env[envKey]; | |
| 70 | + return needsJsonParse ? (tryParse(envValue) ?? defaultValue) : envValue; | |
| 69 | 71 | } |
| 70 | 72 | const config = getConfig(); |
| 71 | 73 | return _.get(config, key, defaultValue); |