Пример #1
0
        public static void InitializeDefaultProxy()
        {
            var proxy = ProxySettingsInitializer.GetProxySettingsFromEnvironment().CreateProxy();

            if (proxy.Some())
            {
                WebRequest.DefaultWebProxy = proxy.Value;
            }
        }
Пример #2
0
        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());
        }