fix(provider): use process.env directly for runtime env mutations (#11482)

This commit is contained in:
Jérôme Benoit
2026-01-31 19:35:23 +01:00
committed by GitHub
parent 121d6a72c0
commit a19ef17bcb

View File

@@ -195,11 +195,13 @@ export namespace Provider {
const awsAccessKeyId = Env.get("AWS_ACCESS_KEY_ID")
// TODO: Using process.env directly because Env.set only updates a process.env shallow copy,
// until the scope of the Env API is clarified (test only or runtime?)
const awsBearerToken = iife(() => {
const envToken = Env.get("AWS_BEARER_TOKEN_BEDROCK")
const envToken = process.env.AWS_BEARER_TOKEN_BEDROCK
if (envToken) return envToken
if (auth?.type === "api") {
Env.set("AWS_BEARER_TOKEN_BEDROCK", auth.key)
process.env.AWS_BEARER_TOKEN_BEDROCK = auth.key
return auth.key
}
return undefined
@@ -376,17 +378,19 @@ export namespace Provider {
},
"sap-ai-core": async () => {
const auth = await Auth.get("sap-ai-core")
// TODO: Using process.env directly because Env.set only updates a shallow copy (not process.env),
// until the scope of the Env API is clarified (test only or runtime?)
const envServiceKey = iife(() => {
const envAICoreServiceKey = Env.get("AICORE_SERVICE_KEY")
const envAICoreServiceKey = process.env.AICORE_SERVICE_KEY
if (envAICoreServiceKey) return envAICoreServiceKey
if (auth?.type === "api") {
Env.set("AICORE_SERVICE_KEY", auth.key)
process.env.AICORE_SERVICE_KEY = auth.key
return auth.key
}
return undefined
})
const deploymentId = Env.get("AICORE_DEPLOYMENT_ID")
const resourceGroup = Env.get("AICORE_RESOURCE_GROUP")
const deploymentId = process.env.AICORE_DEPLOYMENT_ID
const resourceGroup = process.env.AICORE_RESOURCE_GROUP
return {
autoload: !!envServiceKey,