Allow JSON array and objects in env.var configs

0776f65193dcc252c17fe3fc85859905198532da

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +3 -1Showing whitespace changes
src/util.js+3 -1
@@ -65,7 +65,9 @@ export function getConfigValue(key, defaultValue = null, typeConverter = null) {
65 function _getValue() {65 function _getValue() {
66 const envKey = keyToEnv(key);66 const envKey = keyToEnv(key);
67 if (envKey in process.env) {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 const config = getConfig();72 const config = getConfig();
71 return _.get(config, key, defaultValue);73 return _.get(config, key, defaultValue);