api/env: log information about dynamic env changes

This commit is contained in:
jj
2025-06-07 08:34:31 +00:00
parent 5ac87bab09
commit e2b6879ea2
2 changed files with 33 additions and 4 deletions

View File

@@ -12,12 +12,19 @@ export const canonicalEnv = Object.freeze(structuredClone(process.env));
export const setTunnelPort = (port) => env.tunnelPort = port;
export const isCluster = env.instanceCount > 1;
export const updateEnv = (newEnv) => {
const changes = [];
// tunnelPort is special and needs to get carried over here
newEnv.tunnelPort = env.tunnelPort;
for (const key in env) {
if (String(env[key]) !== String(newEnv[key])) {
changes.push(key);
}
env[key] = newEnv[key];
}
return changes;
}
await validateEnvs(env);