1111using System . Threading . Tasks ;
1212using System . Web ;
1313using System . Web . Configuration ;
14- using Microsoft . WindowsAzure . ServiceRuntime ;
1514using NuGet . Services . Configuration ;
1615using NuGet . Services . KeyVault ;
1716using NuGetGallery . Configuration . SecretReader ;
@@ -25,7 +24,6 @@ public class ConfigurationService : IGalleryConfigurationService, IConfiguration
2524 protected const string ServiceBusPrefix = "AzureServiceBus." ;
2625 protected const string PackageDeletePrefix = "PackageDelete." ;
2726
28- private bool _notInCloudService ;
2927 private readonly Lazy < string > _httpSiteRootThunk ;
3028 private readonly Lazy < string > _httpsSiteRootThunk ;
3129 private readonly Lazy < IAppConfiguration > _lazyAppConfiguration ;
@@ -168,21 +166,8 @@ public async Task<string> ReadSettingAsync(string settingName)
168166
169167 public string ReadRawSetting ( string settingName )
170168 {
171- string value ;
172-
173- value = GetCloudServiceSetting ( settingName ) ;
174-
175- if ( value == "null" )
176- {
177- value = null ;
178- }
179- else if ( string . IsNullOrEmpty ( value ) )
180- {
181- var cstr = GetConnectionString ( settingName ) ;
182- value = cstr != null ? cstr . ConnectionString : GetAppSetting ( settingName ) ;
183- }
184-
185- return value ;
169+ var cstr = GetConnectionString ( settingName ) ;
170+ return cstr ? . ConnectionString ?? GetAppSetting ( settingName ) ;
186171 }
187172
188173 protected virtual HttpRequestBase GetCurrentRequest ( )
@@ -210,39 +195,6 @@ private async Task<IPackageDeleteConfiguration> ResolvePackageDelete()
210195 return await ResolveConfigObject ( new PackageDeleteConfiguration ( ) , PackageDeletePrefix ) ;
211196 }
212197
213- protected virtual string GetCloudServiceSetting ( string settingName )
214- {
215- // Short-circuit if we've already determined we're not in the cloud
216- if ( _notInCloudService )
217- {
218- return null ;
219- }
220-
221- string value = null ;
222- try
223- {
224- if ( RoleEnvironment . IsAvailable )
225- {
226- value = RoleEnvironment . GetConfigurationSettingValue ( settingName ) ;
227- }
228- else
229- {
230- _notInCloudService = true ;
231- }
232- }
233- catch ( TypeInitializationException )
234- {
235- // Not in the role environment...
236- _notInCloudService = true ; // Skip future checks to save perf
237- }
238- catch ( Exception )
239- {
240- // Value not present
241- return null ;
242- }
243- return value ;
244- }
245-
246198 protected virtual string GetAppSetting ( string settingName )
247199 {
248200 return WebConfigurationManager . AppSettings [ settingName ] ;
@@ -291,4 +243,4 @@ private string GetHttpsSiteRoot()
291243 return "https://" + siteRoot . Substring ( 7 ) ;
292244 }
293245 }
294- }
246+ }
0 commit comments