fix api-server env override order
This commit is contained in:
@@ -8,7 +8,7 @@ const apiServerExePath = resolve(
|
||||
'server-rs/target/debug/api-server.exe',
|
||||
);
|
||||
|
||||
function loadEnvFile(path, target) {
|
||||
function loadEnvFile(path, target, override = false) {
|
||||
if (!existsSync(path)) {
|
||||
return;
|
||||
}
|
||||
@@ -26,7 +26,7 @@ function loadEnvFile(path, target) {
|
||||
}
|
||||
|
||||
const [, key, rawValue] = match;
|
||||
if (target[key] !== undefined) {
|
||||
if (!override && target[key] !== undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ function loadEnvFile(path, target) {
|
||||
|
||||
const mergedEnv = { ...process.env };
|
||||
loadEnvFile(resolve(repoRoot, '.env'), mergedEnv);
|
||||
loadEnvFile(resolve(repoRoot, '.env.local'), mergedEnv);
|
||||
loadEnvFile(resolve(repoRoot, '.env.secrets.local'), mergedEnv);
|
||||
loadEnvFile(resolve(repoRoot, '.env.local'), mergedEnv, true);
|
||||
loadEnvFile(resolve(repoRoot, '.env.secrets.local'), mergedEnv, true);
|
||||
|
||||
mergedEnv.GENARRATIVE_API_HOST = mergedEnv.GENARRATIVE_API_HOST || '127.0.0.1';
|
||||
mergedEnv.GENARRATIVE_API_PORT = mergedEnv.GENARRATIVE_API_PORT || '3100';
|
||||
|
||||
Reference in New Issue
Block a user