MCPcopy
hub / github.com/callstack/agent-device / readRemoteConfigEnvDefaults

Function readRemoteConfigEnvDefaults

src/remote/remote-config-core.ts:73–90  ·  view source on GitHub ↗
(
  env: Record<string, string | undefined> = process.env,
)

Source from the content-addressed store, hash-verified

71}
72
73function readRemoteConfigEnvDefaults(
74 env: Record<string, string | undefined> = process.env,
75): RemoteConfigProfile {
76 const profile: RemoteConfigProfile = {};
77 for (const spec of REMOTE_CONFIG_PROFILE_FIELD_SPECS) {
78 const envMatch = getRemoteConfigEnvNames(spec.key)
79 .map((name) => ({ name, value: env[name] }))
80 .find((entry) => typeof entry.value === 'string' && entry.value.trim().length > 0);
81 if (!envMatch) continue;
82 (profile as Record<string, unknown>)[spec.key] = parseSourceValue(
83 spec,
84 envMatch.value,
85 `environment variable ${envMatch.name}`,
86 envMatch.name,
87 );
88 }
89 return profile;
90}
91
92function mergeRemoteConfigProfile(
93 ...profiles: Array<RemoteConfigProfile | null | undefined>

Callers 1

Calls 2

getRemoteConfigEnvNamesFunction · 0.90
parseSourceValueFunction · 0.90

Tested by

no test coverage detected