@@ -19,6 +19,10 @@ public class BuildSettings
1919
2020 BuildVersion = new BuildVersion ( context ) ;
2121
22+ MyGetApiKey = GetApiKey ( MYGET_API_KEY , FALLBACK_MYGET_API_KEY ) ;
23+ NuGetApiKey = GetApiKey ( NUGET_API_KEY , FALLBACK_NUGET_API_KEY ) ;
24+ ChocolateyApiKey = GetApiKey ( CHOCO_API_KEY , FALLBACK_CHOCO_API_KEY ) ;
25+
2226 Net35Test = new PackageTest (
2327 "Net35Test" ,
2428 "Run mock-assembly.dll under .NET 3.5" ,
@@ -175,9 +179,9 @@ public class BuildSettings
175179 public bool ShouldPublishToChocolatey => ! IsPreRelease || LABELS_WE_PUBLISH_ON_CHOCOLATEY . Contains ( PreReleaseLabel ) ;
176180 public bool IsProductionRelease => ! IsPreRelease || LABELS_WE_RELEASE_ON_GITHUB . Contains ( PreReleaseLabel ) ;
177181
178- public string MyGetApiKey => _context . EnvironmentVariable ( MYGET_API_KEY ) ;
179- public string NuGetApiKey => _context . EnvironmentVariable ( NUGET_API_KEY ) ;
180- public string ChocolateyApiKey => _context . EnvironmentVariable ( CHOCO_API_KEY ) ;
182+ public string MyGetApiKey { get ; }
183+ public string NuGetApiKey { get ; }
184+ public string ChocolateyApiKey { get ; }
181185
182186 public string GitHubAccessToken => _context . EnvironmentVariable ( GITHUB_ACCESS_TOKEN ) ;
183187
@@ -291,6 +295,16 @@ public class BuildSettings
291295 Console . WriteLine ( $ " NetCore Runner: { NETCORE_CONSOLE_PROJECT } ") ;
292296 }
293297
298+ private string GetApiKey ( string name , string fallback = null )
299+ {
300+ var apikey = _context . EnvironmentVariable ( name ) ;
301+
302+ if ( string . IsNullOrEmpty ( apikey ) && fallback != null )
303+ apikey = _context . EnvironmentVariable ( fallback ) ;
304+
305+ return apikey ;
306+ }
307+
294308 private void ShowApiKeyAvailability ( string apikey )
295309 {
296310 if ( string . IsNullOrEmpty ( apikey ) )
0 commit comments