applyConfigEnvironmentVariables function
void
applyConfigEnvironmentVariables({})
Apply ALL environment variables after trust is established.
Implementation
void applyConfigEnvironmentVariables({
required Map<String, String>? Function() getGlobalConfigEnv,
required Map<String, String>? Function() getAllSettingsEnv,
void Function()? clearCACertsCache,
void Function()? clearMTLSCache,
void Function()? clearProxyCache,
void Function()? configureGlobalAgents,
}) {
final globalEnv = filterSettingsEnv(getGlobalConfigEnv());
globalEnv.forEach((key, value) {
Platform.environment[key] = value;
});
final settingsEnv = filterSettingsEnv(getAllSettingsEnv());
settingsEnv.forEach((key, value) {
Platform.environment[key] = value;
});
// Clear caches so agents are rebuilt with the new env vars
clearCACertsCache?.call();
clearMTLSCache?.call();
clearProxyCache?.call();
// Reconfigure proxy/mTLS agents to pick up any proxy env vars from settings
configureGlobalAgents?.call();
}