Skip to content

Commit

Permalink
(chocolateyGH-605) Use Proxy From Environment Vars
Browse files Browse the repository at this point in the history
If `http_proxy`/`https_proxy` are set in environment variables, use
those for Chocolatey automatically. If `no_proxy` is set, then use it
for the proxy bypass list.
  • Loading branch information
ferventcoder committed Feb 20, 2017
1 parent dd3dede commit f1ac453
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -87,6 +87,11 @@ public static void set_environment_variables(ChocolateyConfiguration config)
Environment.SetEnvironmentVariable("chocolateyRequestTimeout", config.WebRequestTimeoutSeconds.to_string() + "000");
Environment.SetEnvironmentVariable("chocolateyResponseTimeout", config.CommandExecutionTimeoutSeconds.to_string() + "000");


if (!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("https_proxy"))) Environment.SetEnvironmentVariable("chocolateyProxyLocation", Environment.GetEnvironmentVariable("https_proxy"));
if (!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("http_proxy")) && string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("chocolateyProxyLocation"))) Environment.SetEnvironmentVariable("chocolateyProxyLocation", Environment.GetEnvironmentVariable("http_proxy"));
if (!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("no_proxy"))) Environment.SetEnvironmentVariable("chocolateyProxyBypassList", Environment.GetEnvironmentVariable("no_proxy"));

if (!string.IsNullOrWhiteSpace(config.Proxy.Location))
{
var proxyCreds = string.Empty;
Expand Down

0 comments on commit f1ac453

Please sign in to comment.