fix: 修复环境变量多个下划线不生效的bug

This commit is contained in:
xiaojunnuo
2024-08-05 17:47:56 +08:00
parent e8ed97206b
commit 7ec2218c9f
2 changed files with 2 additions and 1 deletions
+1
View File
@@ -13,3 +13,4 @@ typeorm:
username: postgres username: postgres
password: root password: root
database: postgres database: postgres
@@ -12,7 +12,7 @@ function parseEnv(defaultConfig: any) {
continue; continue;
} }
keyName = keyName.replace('certd_', ''); keyName = keyName.replace('certd_', '');
const configKey = keyName.replace('_', '.'); const configKey = keyName.replaceAll('_', '.');
const oldValue = _.get(defaultConfig, configKey); const oldValue = _.get(defaultConfig, configKey);
let value: any = process.env[key]; let value: any = process.env[key];
if (typeof oldValue === 'boolean') { if (typeof oldValue === 'boolean') {