Skip to content

Commit

Permalink
(chocolatey#62) Allow disabling of the DefaultPushSource
Browse files Browse the repository at this point in the history
If the DefaultPushSource is set to "disabled", this will throw an error
message saying that an source must be specified in the command.

As DefaultPushSource overrides the built-in default of
"ChocolateyCommunityFeedPushSource", the end behavior is that if it is
set to "disabled", then a source must be passed with --source.

This behavior is useful if a user wants has multiple repositories and
wants to always have to explicitly specify a source so as to make sure
to push package to the correct source.
  • Loading branch information
TheCakeIsNaOH committed Nov 13, 2021
1 parent 3fbd84a commit 5a563fc
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ public virtual void handle_validation(ChocolateyConfiguration configuration)
throw new ApplicationException("Source is required. Please pass a source to push to, such as --source={0}".format_with(ApplicationParameters.ChocolateyCommunityFeedPushSource));
}

if (configuration.Sources.is_equal_to("disabled"))
{
throw new ApplicationException("Default push source is disabled. Please pass a source to push to, such as --source={0}".format_with(ApplicationParameters.ChocolateyCommunityFeedPushSource));
}

var remoteSource = new Uri(configuration.Sources);

if (string.IsNullOrWhiteSpace(configuration.PushCommand.Key) && !remoteSource.IsUnc && !remoteSource.IsFile)
Expand Down

0 comments on commit 5a563fc

Please sign in to comment.