Allow JSON array and objects in env.var configs

0776f65193dcc252c17fe3fc85859905198532da

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

1 files changed, +3 -1Ignore whitespace
src/util.js+3 -1
@@ -65,7 +65,9 @@ export function getConfigValue(key, defaultValue = null, typeConverter = null) {
6565 function _getValue() {
6666 const envKey = keyToEnv(key);
6767 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;
6971 }
7072 const config = getConfig();
7173 return _.get(config, key, defaultValue);