Skip to content

Commit 29aa75c

Browse files
jerome-benoitishaksebsib
authored andcommitted
fix(provider): use process.env directly for runtime env mutations (anomalyco#11482)
1 parent 578acd2 commit 29aa75c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

packages/opencode/src/provider/provider.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,13 @@ export namespace Provider {
195195

196196
const awsAccessKeyId = Env.get("AWS_ACCESS_KEY_ID")
197197

198+
// TODO: Using process.env directly because Env.set only updates a process.env shallow copy,
199+
// until the scope of the Env API is clarified (test only or runtime?)
198200
const awsBearerToken = iife(() => {
199-
const envToken = Env.get("AWS_BEARER_TOKEN_BEDROCK")
201+
const envToken = process.env.AWS_BEARER_TOKEN_BEDROCK
200202
if (envToken) return envToken
201203
if (auth?.type === "api") {
202-
Env.set("AWS_BEARER_TOKEN_BEDROCK", auth.key)
204+
process.env.AWS_BEARER_TOKEN_BEDROCK = auth.key
203205
return auth.key
204206
}
205207
return undefined
@@ -376,17 +378,19 @@ export namespace Provider {
376378
},
377379
"sap-ai-core": async () => {
378380
const auth = await Auth.get("sap-ai-core")
381+
// TODO: Using process.env directly because Env.set only updates a shallow copy (not process.env),
382+
// until the scope of the Env API is clarified (test only or runtime?)
379383
const envServiceKey = iife(() => {
380-
const envAICoreServiceKey = Env.get("AICORE_SERVICE_KEY")
384+
const envAICoreServiceKey = process.env.AICORE_SERVICE_KEY
381385
if (envAICoreServiceKey) return envAICoreServiceKey
382386
if (auth?.type === "api") {
383-
Env.set("AICORE_SERVICE_KEY", auth.key)
387+
process.env.AICORE_SERVICE_KEY = auth.key
384388
return auth.key
385389
}
386390
return undefined
387391
})
388-
const deploymentId = Env.get("AICORE_DEPLOYMENT_ID")
389-
const resourceGroup = Env.get("AICORE_RESOURCE_GROUP")
392+
const deploymentId = process.env.AICORE_DEPLOYMENT_ID
393+
const resourceGroup = process.env.AICORE_RESOURCE_GROUP
390394

391395
return {
392396
autoload: !!envServiceKey,

0 commit comments

Comments
 (0)