( env: Record<string, string | undefined> = process.env, )
| 71 | } |
| 72 | |
| 73 | function 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 | |
| 92 | function mergeRemoteConfigProfile( |
| 93 | ...profiles: Array<RemoteConfigProfile | null | undefined> |
no test coverage detected