mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 13:20:43 +00:00
fix: declare google vertex local auth evidence
This commit is contained in:
@@ -76,7 +76,18 @@
|
|||||||
{
|
{
|
||||||
"id": "google-vertex",
|
"id": "google-vertex",
|
||||||
"authMethods": ["api-key"],
|
"authMethods": ["api-key"],
|
||||||
"envVars": ["GOOGLE_CLOUD_API_KEY"]
|
"envVars": ["GOOGLE_CLOUD_API_KEY"],
|
||||||
|
"authEvidence": [
|
||||||
|
{
|
||||||
|
"type": "local-file-with-env",
|
||||||
|
"fileEnvVar": "GOOGLE_APPLICATION_CREDENTIALS",
|
||||||
|
"fallbackPaths": ["${HOME}/.config/gcloud/application_default_credentials.json"],
|
||||||
|
"requiresAnyEnv": ["GOOGLE_CLOUD_PROJECT", "GCLOUD_PROJECT"],
|
||||||
|
"requiresAllEnv": ["GOOGLE_CLOUD_LOCATION"],
|
||||||
|
"credentialMarker": "gcp-vertex-credentials",
|
||||||
|
"source": "gcloud adc"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ vi.mock("./model-auth-env-vars.js", () => {
|
|||||||
const candidates = {
|
const candidates = {
|
||||||
anthropic: ["ANTHROPIC_OAUTH_TOKEN", "ANTHROPIC_API_KEY"],
|
anthropic: ["ANTHROPIC_OAUTH_TOKEN", "ANTHROPIC_API_KEY"],
|
||||||
google: ["GEMINI_API_KEY", "GOOGLE_API_KEY"],
|
google: ["GEMINI_API_KEY", "GOOGLE_API_KEY"],
|
||||||
|
"google-vertex": ["GOOGLE_CLOUD_API_KEY"],
|
||||||
"demo-local": ["DEMO_LOCAL_API_KEY"],
|
"demo-local": ["DEMO_LOCAL_API_KEY"],
|
||||||
huggingface: ["HUGGINGFACE_HUB_TOKEN", "HF_TOKEN"],
|
huggingface: ["HUGGINGFACE_HUB_TOKEN", "HF_TOKEN"],
|
||||||
"minimax-portal": ["MINIMAX_OAUTH_TOKEN", "MINIMAX_API_KEY"],
|
"minimax-portal": ["MINIMAX_OAUTH_TOKEN", "MINIMAX_API_KEY"],
|
||||||
@@ -109,6 +110,19 @@ vi.mock("./model-auth-env-vars.js", () => {
|
|||||||
PROVIDER_ENV_API_KEY_CANDIDATES: candidates,
|
PROVIDER_ENV_API_KEY_CANDIDATES: candidates,
|
||||||
listKnownProviderEnvApiKeyNames: () => [...new Set(Object.values(candidates).flat())],
|
listKnownProviderEnvApiKeyNames: () => [...new Set(Object.values(candidates).flat())],
|
||||||
resolveProviderEnvApiKeyCandidates: () => candidates,
|
resolveProviderEnvApiKeyCandidates: () => candidates,
|
||||||
|
resolveProviderEnvAuthEvidence: () => ({
|
||||||
|
"google-vertex": [
|
||||||
|
{
|
||||||
|
type: "local-file-with-env",
|
||||||
|
fileEnvVar: "GOOGLE_APPLICATION_CREDENTIALS",
|
||||||
|
fallbackPaths: ["${HOME}/.config/gcloud/application_default_credentials.json"],
|
||||||
|
requiresAnyEnv: ["GOOGLE_CLOUD_PROJECT", "GCLOUD_PROJECT"],
|
||||||
|
requiresAllEnv: ["GOOGLE_CLOUD_LOCATION"],
|
||||||
|
credentialMarker: "gcp-vertex-credentials",
|
||||||
|
source: "gcloud adc",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -812,7 +826,7 @@ describe("getApiKeyForModel", () => {
|
|||||||
} as NodeJS.ProcessEnv);
|
} as NodeJS.ProcessEnv);
|
||||||
|
|
||||||
expect(resolved?.apiKey).toBe("google-cloud-api-key");
|
expect(resolved?.apiKey).toBe("google-cloud-api-key");
|
||||||
expect(resolved?.source).toBe("gcloud adc");
|
expect(resolved?.source).toBe("env: GOOGLE_CLOUD_API_KEY");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("resolveEnvApiKey('google-vertex') accepts ADC credentials from the provided env snapshot", async () => {
|
it("resolveEnvApiKey('google-vertex') accepts ADC credentials from the provided env snapshot", async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user