@@ -28,13 +28,15 @@ public interface IBlobRepository
28
28
public class BlobRepository : IBlobRepository
29
29
{
30
30
private static readonly BlobServiceClient BlobServiceClient ;
31
+ private static readonly string ServiceUri = Environment . GetEnvironmentVariable ( "STORAGE_BLOB_SERVICE_URI" ) ;
32
+ private static readonly string StorageAccountName = Environment . GetEnvironmentVariable ( "STORAGE_ACCOUNT_NAME" ) ;
33
+ private static readonly string StorageAccountKey = Environment . GetEnvironmentVariable ( "STORAGE_ACCOUNT_KEY" ) ;
31
34
32
35
static BlobRepository ( )
33
36
{
34
37
// connect to Azure Storage
35
- string serviceUri = Environment . GetEnvironmentVariable ( "STORAGE_BLOB_SERVICE_URI" ) ;
36
- var credential = new StorageSharedKeyCredential ( Environment . GetEnvironmentVariable ( "STORAGE_ACCOUNT_NAME" ) , Environment . GetEnvironmentVariable ( "STORAGE_ACCOUNT_KEY" ) ) ;
37
- BlobServiceClient = new BlobServiceClient ( new Uri ( serviceUri ) , credential ) ;
38
+ StorageSharedKeyCredential credential = new StorageSharedKeyCredential ( StorageAccountName , StorageAccountKey ) ;
39
+ BlobServiceClient = new BlobServiceClient ( new Uri ( ServiceUri ) , credential ) ;
38
40
}
39
41
40
42
public BlockBlobClient CreatePlaceholderBlob ( string containerName , string blobId )
@@ -113,7 +115,7 @@ public async Task UpdateBlobMetadataAsync(BlockBlobClient blob, IDictionary<stri
113
115
public string GetSasTokenForBlob ( BlockBlobClient blob , BlobSasBuilder sasBuilder )
114
116
{
115
117
// Create a SharedKeyCredential that we can use to sign the SAS token
116
- var credential = new StorageSharedKeyCredential ( Environment . GetEnvironmentVariable ( "STORAGE_ACCOUNT_NAME" ) , Environment . GetEnvironmentVariable ( "STORAGE_ACCOUNT_KEY" ) ) ;
118
+ var credential = new StorageSharedKeyCredential ( StorageAccountName , StorageAccountKey ) ;
117
119
118
120
// Build a SAS URI
119
121
UriBuilder sasUri = new UriBuilder ( blob . Uri )
0 commit comments