@@ -24,6 +24,7 @@ import { buildServiceEnvironment } from "../daemon/service-env.js";
2424import {
2525 formatManagedServiceEnvKeys ,
2626 hasEnvironmentFileSource ,
27+ readEnvironmentValueSource ,
2728 readManagedServiceEnvKeysFromEnvironment ,
2829} from "../daemon/service-managed-env.js" ;
2930import { isNonMinimalServicePathEntry } from "../daemon/service-path-policy.js" ;
@@ -500,22 +501,6 @@ function collectPreservedExistingServiceEnvVars(
500501 return preserved ;
501502}
502503
503- function readExistingEnvironmentValueSource ( params : {
504- existingEnvironmentValueSources ?: Record <
505- string ,
506- GatewayServiceEnvironmentValueSource | undefined
507- > ;
508- normalizedKey : string ;
509- } ) : GatewayServiceEnvironmentValueSource | undefined {
510- for ( const [ rawKey , source ] of Object . entries ( params . existingEnvironmentValueSources ?? { } ) ) {
511- const key = normalizeEnvVarKey ( rawKey , { portable : true } ) ?. toUpperCase ( ) ;
512- if ( key === params . normalizedKey ) {
513- return source ;
514- }
515- }
516- return undefined ;
517- }
518-
519504function collectExistingEnvironmentFileManagedServiceEnvVars ( params : {
520505 existingEnvironment : Record < string , string | undefined > | undefined ;
521506 existingEnvironmentValueSources ?: Record <
@@ -540,10 +525,10 @@ function collectExistingEnvironmentFileManagedServiceEnvVars(params: {
540525 if ( isDangerousHostEnvVarName ( key ) || isDangerousHostEnvOverrideVarName ( key ) ) {
541526 continue ;
542527 }
543- const source = readExistingEnvironmentValueSource ( {
544- existingEnvironmentValueSources : params . existingEnvironmentValueSources ,
528+ const source = readEnvironmentValueSource (
529+ params . existingEnvironmentValueSources ,
545530 normalizedKey ,
546- } ) ;
531+ ) ;
547532 if ( ! hasEnvironmentFileSource ( source ) ) {
548533 continue ;
549534 }
@@ -651,10 +636,7 @@ async function buildGatewayInstallEnvironment(params: {
651636 const plan = createMutableServiceEnvPlan ( ) ;
652637 addServiceEnvPlanEntries ( plan , preservedExistingEnvironment , {
653638 valueSource : ( { normalizedKey } ) =>
654- readExistingEnvironmentValueSource ( {
655- existingEnvironmentValueSources : params . existingEnvironmentValueSources ,
656- normalizedKey,
657- } ) ?? "inline" ,
639+ readEnvironmentValueSource ( params . existingEnvironmentValueSources , normalizedKey ) ?? "inline" ,
658640 } ) ;
659641 addServiceEnvPlanEntries ( plan , stateDirDotEnvEnvironment , { } ) ;
660642 addServiceEnvPlanEntries ( plan , configEnvironment , { } ) ;
0 commit comments