fix(auth): support ${ENV_VAR} syntax expansion and prioritize CCLOAD_API_KEY in image provider

This commit is contained in:
openclaw committed 2026-10-19 06:35:38 +00:00
1 parent 723882b974
commit 7472270e1f
4 files changed
+28 -8

No files matched your search

+6 -1
View File
@@ -10,7 +10,12 @@ const OPENAI_VIDEO_SECONDS = [4, 8, 12];
const OPENAI_VIDEO_SIZES = ["720x1280", "1280x720", "1024x1792", "1792x1024"];
export function resolvePluginApiKey(rawKey) {
if (typeof rawKey === "string") {
return normalizeOptionalString(rawKey);
const trimmed = rawKey.trim();
const envMatch = trimmed.match(/^\$\{([A-Za-z0-9_]+)\}$/);
if (envMatch) {
return normalizeOptionalString(process.env[envMatch[1]]);
}
return normalizeOptionalString(trimmed);
}
if (rawKey && typeof rawKey === "object" && typeof rawKey.id === "string") {
return normalizeOptionalString(process.env[rawKey.id]);