Skip to content

Commit

Permalink
(GH-1173) Set proxy information at runtime
Browse files Browse the repository at this point in the history
Allow passing proxy override information with each command. This allows
the following items to be passed: `--proxy="'value'"
--proxy-user="'<user>'" --proxy-password="'<pwd>'"
--proxy-bypass-list="'<comma separated, list>'"
--proxy-bypass-on-local`.
  • Loading branch information
ferventcoder committed Feb 28, 2017
1 parent 026e2a5 commit 9a2a517
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function script:chocoCmdOperations($commands, $command, $filter, $currentArgumen

$script:someCommands = @('-?','search','list','info','install','outdated','upgrade','uninstall','new','download','pack','push','-h','--help','pin','source','config','feature','apikey')

$allcommands = " --debug --verbose --force --noop --help --accept-license --confirm --limit-output --execution-timeout= --cache-location='' --fail-on-error-output --use-system-powershell"
$allcommands = " --debug --verbose --force --noop --help --accept-license --confirm --limit-output --no-progress --execution-timeout= --cache-location='' --proxy='' --proxy-user= --proxy-password= --proxy-bypass-list='' --proxy-bypass-on-local --fail-on-error-output --use-system-powershell"
$proInstallUpgradeOptions = " --install-directory='Pro/Biz editions' --skip-download-cache --use-download-cache --skip-virus-check --virus-check --virus-positives-minimum="
$proNewOptions = " --file=<biz>"

Expand Down
15 changes: 15 additions & 0 deletions src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,21 @@ private static void set_global_options(IList<string> args, ChocolateyConfigurati
.Add("no-progress",
"Do Not Show Progress - Do not show download progress percentages. Available in 0.10.4+.",
option => config.Features.ShowDownloadProgress = option == null)
.Add("proxy=",
"Proxy Location - Explicit proxy location. Overrides the default proxy location of '{0}'. Available for config settings in 0.9.9.9+, this CLI option available in 0.10.4+.".format_with(config.Proxy.Location),
option => config.Proxy.Location = option.remove_surrounding_quotes())
.Add("proxy-user=",
"Proxy User Name - Explicit proxy user (optional). Requires explicity proxy (`--proxy` or config setting). Overrides the default proxy user of '{0}'. Available for config settings in 0.9.9.9+, this CLI option available in 0.10.4+.".format_with(config.Proxy.User),
option => config.Proxy.User = option.remove_surrounding_quotes())
.Add("proxy-password=",
"Proxy Password - Explicit proxy password (optional) to be used with username. Requires explicity proxy (`--proxy` or config setting) and user name. Overrides the default proxy password (encrypted in settings if set). Available for config settings in 0.9.9.9+, this CLI option available in 0.10.4+.",
option => config.Proxy.EncryptedPassword = NugetEncryptionUtility.EncryptString(option.remove_surrounding_quotes()))
.Add("proxy-bypass-list=",
"ProxyBypassList - Comma separated list of regex locations to bypass on proxy. Requires explicity proxy (`--proxy` or config setting). Overrides the default proxy bypass list of '{0}'. Available in 0.10.4+.".format_with(config.Proxy.BypassList),
option => config.Proxy.BypassList = option.remove_surrounding_quotes())
.Add("proxy-bypass-on-local",
"Proxy Bypass On Local - Bypass proxy for local connections. Requires explicity proxy (`--proxy` or config setting). Overrides the default proxy bypass on local setting of '{0}'. Available in 0.10.4+.".format_with(config.Proxy.BypassOnLocal),
option => config.Proxy.BypassOnLocal = option != null)
;
},
(unparsedArgs) =>
Expand Down

0 comments on commit 9a2a517

Please sign in to comment.