From b24a6c77712b3921bc8f8766f42f525704fad60e Mon Sep 17 00:00:00 2001 From: TheCakeIsNaOH Date: Thu, 28 Oct 2021 21:06:05 -0500 Subject: [PATCH] (#62) Add new config value DefaultPushSource This config value will be used to set the default source used for choco push. The default value will be overridden if the user specifies --source. The value goes into config.PushCommand.DefaultSource --- src/chocolatey/infrastructure.app/ApplicationParameters.cs | 1 + .../infrastructure.app/builders/ConfigurationBuilder.cs | 1 + .../infrastructure.app/configuration/ChocolateyConfiguration.cs | 1 + 3 files changed, 3 insertions(+) diff --git a/src/chocolatey/infrastructure.app/ApplicationParameters.cs b/src/chocolatey/infrastructure.app/ApplicationParameters.cs index 7adf72112..b80cdf05a 100644 --- a/src/chocolatey/infrastructure.app/ApplicationParameters.cs +++ b/src/chocolatey/infrastructure.app/ApplicationParameters.cs @@ -194,6 +194,7 @@ public static class ConfigSettings public static readonly string WebRequestTimeoutSeconds = "webRequestTimeoutSeconds"; public static readonly string UpgradeAllExceptions = "upgradeAllExceptions"; public static readonly string DefaultTemplateName = "defaultTemplateName"; + public static readonly string DefaultPushSource = "defaultPushSource"; } public static class Features diff --git a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs index 3d86802a8..4388bb13a 100644 --- a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs +++ b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs @@ -267,6 +267,7 @@ private static void set_config_items(ChocolateyConfiguration config, ConfigFileS config.Proxy.BypassOnLocal = set_config_item(ApplicationParameters.ConfigSettings.ProxyBypassOnLocal, configFileSettings, "true", "Bypass proxy for local connections. Available in 0.10.4+.").is_equal_to(bool.TrueString); config.UpgradeCommand.PackageNamesToSkip = set_config_item(ApplicationParameters.ConfigSettings.UpgradeAllExceptions, configFileSettings, string.Empty, "A comma-separated list of package names that should not be upgraded when running `choco upgrade all'. Defaults to empty. Available in 0.10.14+."); config.DefaultTemplateName = set_config_item(ApplicationParameters.ConfigSettings.DefaultTemplateName, configFileSettings, string.Empty, "Default template name used when running 'choco new' command. Available in 0.12.0+."); + config.PushCommand.DefaultSource = set_config_item(ApplicationParameters.ConfigSettings.DefaultPushSource, configFileSettings, string.Empty, "Default source to push packages to when running 'choco push' command. Available in 0.12.0 +."); } private static string set_config_item(string configName, ConfigFileSettings configFileSettings, string defaultValue, string description, bool forceSettingValue = false) diff --git a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs index f827bafdc..9c0cce41e 100644 --- a/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs +++ b/src/chocolatey/infrastructure.app/configuration/ChocolateyConfiguration.cs @@ -665,6 +665,7 @@ public PackCommandConfiguration() public sealed class PushCommandConfiguration { public string Key { get; set; } + public string DefaultSource { get; set; } //DisableBuffering? }