@@ -26,6 +26,9 @@ public class HomeController : Controller
26
26
private static string [ ] containerAddresses = null ;
27
27
private static string [ ] tokens = null ;
28
28
29
+ // this should match the default value used in appsettings.json.
30
+ private static string defaultContainerUriValue = "https://{storage-account-name}.blob.core.windows.net/{container-name}" ;
31
+
29
32
public HomeController ( IConfiguration configuration )
30
33
{
31
34
_configuration = configuration ;
@@ -278,13 +281,19 @@ private string[] GetContainerSasUris()
278
281
279
282
// Get token for second indexer data source
280
283
containerAddresses [ 1 ] = _configuration . GetSection ( "StorageContainerAddress2" ) ? . Value . ToLower ( ) ;
281
- CloudBlobContainer container2 = new CloudBlobContainer ( new Uri ( containerAddresses [ 1 ] ) , new StorageCredentials ( accountName , accountKey ) ) ;
282
- tokens [ 1 ] = container2 . GetSharedAccessSignature ( adHocPolicy , null ) ;
284
+ if ( ! String . Equals ( containerAddresses [ 1 ] , defaultContainerUriValue ) )
285
+ {
286
+ CloudBlobContainer container2 = new CloudBlobContainer ( new Uri ( containerAddresses [ 1 ] ) , new StorageCredentials ( accountName , accountKey ) ) ;
287
+ tokens [ 1 ] = container2 . GetSharedAccessSignature ( adHocPolicy , null ) ;
288
+ }
283
289
284
290
// Get token for third indexer data source
285
291
containerAddresses [ 2 ] = _configuration . GetSection ( "StorageContainerAddress3" ) ? . Value . ToLower ( ) ;
286
- CloudBlobContainer container3 = new CloudBlobContainer ( new Uri ( containerAddresses [ 2 ] ) , new StorageCredentials ( accountName , accountKey ) ) ;
287
- tokens [ 2 ] = container3 . GetSharedAccessSignature ( adHocPolicy , null ) ;
292
+ if ( ! String . Equals ( containerAddresses [ 2 ] , defaultContainerUriValue ) )
293
+ {
294
+ CloudBlobContainer container3 = new CloudBlobContainer ( new Uri ( containerAddresses [ 2 ] ) , new StorageCredentials ( accountName , accountKey ) ) ;
295
+ tokens [ 2 ] = container3 . GetSharedAccessSignature ( adHocPolicy , null ) ;
296
+ }
288
297
}
289
298
290
299
return tokens ;
0 commit comments