fix: propagate config env vars to gateway services (#1735) (thanks @Seredeep)
This commit is contained in:
23
src/config/env-vars.ts
Normal file
23
src/config/env-vars.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import type { ClawdbotConfig } from "./types.js";
|
||||
|
||||
export function collectConfigEnvVars(cfg?: ClawdbotConfig): Record<string, string> {
|
||||
const envConfig = cfg?.env;
|
||||
if (!envConfig) return {};
|
||||
|
||||
const entries: Record<string, string> = {};
|
||||
|
||||
if (envConfig.vars) {
|
||||
for (const [key, value] of Object.entries(envConfig.vars)) {
|
||||
if (!value) continue;
|
||||
entries[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
for (const [key, value] of Object.entries(envConfig)) {
|
||||
if (key === "shellEnv" || key === "vars") continue;
|
||||
if (typeof value !== "string" || !value.trim()) continue;
|
||||
entries[key] = value;
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
Reference in New Issue
Block a user