public static void InitializeDefaultProxy() { var proxy = ProxySettingsInitializer.GetProxySettingsFromEnvironment().CreateProxy(); if (proxy.Some()) { WebRequest.DefaultWebProxy = proxy.Value; } }
public static IEnumerable <EnvironmentVariable> GenerateProxyEnvironmentVariables() { var environmentVariables = Environment.GetEnvironmentVariables(); var existingProxyEnvironmentVariables = new HashSet <string>(ProxyEnvironmentVariableNames.Where(environmentVariables.Contains), StringComparer.Ordinal); if (existingProxyEnvironmentVariables.Any()) { Log.Verbose("Proxy related environment variables already exist. Calamari will not overwrite any proxy environment variables."); return(DuplicateVariablesWithUpperAndLowerCasing(existingProxyEnvironmentVariables, environmentVariables)); } Log.Verbose("Setting Proxy Environment Variables"); return(ProxySettingsInitializer.GetProxySettingsFromEnvironment().GenerateEnvironmentVariables()); }