fix: preserve google vertex adc auth fallback · openclaw/openclaw@587ce45
shakkernerd
·
2026-04-30
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -827,6 +827,29 @@ describe("getApiKeyForModel", () => {
|
827 | 827 | }); |
828 | 828 | }); |
829 | 829 | |
| 830 | +it("resolveEnvApiKey('google-vertex') keeps ADC fallback when manifest env candidates are empty", async () => { |
| 831 | +const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-google-adc-candidates-")); |
| 832 | +const credentialsPath = path.join(tempDir, "adc.json"); |
| 833 | +await fs.writeFile(credentialsPath, "{}", "utf8"); |
| 834 | + |
| 835 | +try { |
| 836 | +const resolved = resolveEnvApiKey( |
| 837 | +"google-vertex", |
| 838 | +{ |
| 839 | +GOOGLE_APPLICATION_CREDENTIALS: credentialsPath, |
| 840 | +GOOGLE_CLOUD_LOCATION: "us-central1", |
| 841 | +GOOGLE_CLOUD_PROJECT: "vertex-project", |
| 842 | +} as NodeJS.ProcessEnv, |
| 843 | +{ candidateMap: { "google-vertex": ["GOOGLE_CLOUD_API_KEY"] } }, |
| 844 | +); |
| 845 | + |
| 846 | +expect(resolved?.apiKey).toBe("gcp-vertex-credentials"); |
| 847 | +expect(resolved?.source).toBe("gcloud adc"); |
| 848 | +} finally { |
| 849 | +await fs.rm(tempDir, { recursive: true, force: true }); |
| 850 | +} |
| 851 | +}); |
| 852 | + |
830 | 853 | it("resolveEnvApiKey('anthropic-vertex') accepts GOOGLE_APPLICATION_CREDENTIALS with project_id", async () => { |
831 | 854 | await expectVertexAdcEnvApiKey({ |
832 | 855 | provider: "anthropic-vertex", |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。