Skip to content

Commit

Permalink
[Hotfix] Fix an NRE in darc (#3631)
Browse files Browse the repository at this point in the history
  • Loading branch information
premun authored Jun 12, 2024
1 parent edcb1a8 commit a275667
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Microsoft.DotNet.Darc/Darc/Helpers/LocalSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,15 @@ static string PreferOptionToSetting(string option, string localSetting)
return !string.IsNullOrEmpty(option) ? option : localSetting;
}

// Prefer the command line options over the settings file
localSettings ??= new LocalSettings();

if (string.IsNullOrEmpty(localSettings.BuildAssetRegistryToken))
{
// Old way of storing the settings had the password and not the token
localSettings.BuildAssetRegistryToken = localSettings.BuildAssetRegistryPassword;
}

// Prefer the command line options over the settings file
localSettings ??= new LocalSettings();
localSettings.AzureDevOpsToken = PreferOptionToSetting(options.AzureDevOpsPat, localSettings.AzureDevOpsToken);
localSettings.GitHubToken = PreferOptionToSetting(options.GitHubPat, localSettings.GitHubToken);
localSettings.BuildAssetRegistryToken = PreferOptionToSetting(options.BuildAssetRegistryToken, localSettings.BuildAssetRegistryToken);
Expand Down

0 comments on commit a275667

Please sign in to comment.