fix(provider): use process.env directly for runtime env mutations (#11482)
This commit is contained in:
@@ -195,11 +195,13 @@ export namespace Provider {
|
|||||||
|
|
||||||
const awsAccessKeyId = Env.get("AWS_ACCESS_KEY_ID")
|
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 awsBearerToken = iife(() => {
|
||||||
const envToken = Env.get("AWS_BEARER_TOKEN_BEDROCK")
|
const envToken = process.env.AWS_BEARER_TOKEN_BEDROCK
|
||||||
if (envToken) return envToken
|
if (envToken) return envToken
|
||||||
if (auth?.type === "api") {
|
if (auth?.type === "api") {
|
||||||
Env.set("AWS_BEARER_TOKEN_BEDROCK", auth.key)
|
process.env.AWS_BEARER_TOKEN_BEDROCK = auth.key
|
||||||
return auth.key
|
return auth.key
|
||||||
}
|
}
|
||||||
return undefined
|
return undefined
|
||||||
@@ -376,17 +378,19 @@ export namespace Provider {
|
|||||||
},
|
},
|
||||||
"sap-ai-core": async () => {
|
"sap-ai-core": async () => {
|
||||||
const auth = await Auth.get("sap-ai-core")
|
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 envServiceKey = iife(() => {
|
||||||
const envAICoreServiceKey = Env.get("AICORE_SERVICE_KEY")
|
const envAICoreServiceKey = process.env.AICORE_SERVICE_KEY
|
||||||
if (envAICoreServiceKey) return envAICoreServiceKey
|
if (envAICoreServiceKey) return envAICoreServiceKey
|
||||||
if (auth?.type === "api") {
|
if (auth?.type === "api") {
|
||||||
Env.set("AICORE_SERVICE_KEY", auth.key)
|
process.env.AICORE_SERVICE_KEY = auth.key
|
||||||
return auth.key
|
return auth.key
|
||||||
}
|
}
|
||||||
return undefined
|
return undefined
|
||||||
})
|
})
|
||||||
const deploymentId = Env.get("AICORE_DEPLOYMENT_ID")
|
const deploymentId = process.env.AICORE_DEPLOYMENT_ID
|
||||||
const resourceGroup = Env.get("AICORE_RESOURCE_GROUP")
|
const resourceGroup = process.env.AICORE_RESOURCE_GROUP
|
||||||
|
|
||||||
return {
|
return {
|
||||||
autoload: !!envServiceKey,
|
autoload: !!envServiceKey,
|
||||||
|
|||||||
Reference in New Issue
Block a user