Skip to content

Commit

Permalink
add validation for null or empty table storage secret name
Browse files Browse the repository at this point in the history
Related to: aliencube#300
  • Loading branch information
sikutisa committed Sep 12, 2024
1 parent f4e375c commit 6628d53
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ public static IServiceCollection AddTableStorageService(this IServiceCollection
var clientSecret = sp.GetService<SecretClient>()
?? throw new InvalidOperationException($"{nameof(SecretClient)} service is not registered.");
if (string.IsNullOrWhiteSpace(settings.SecretNames[KeyVaultSecretNames.Storage]) == true)
{
throw new InvalidOperationException($"{nameof(KeyVaultSettings.SecretNames)}.{KeyVaultSecretNames.Storage} is not defined.");
}
var storageKeyVault = clientSecret.GetSecret(settings.SecretNames[KeyVaultSecretNames.Storage]!);
var client = new TableServiceClient(storageKeyVault.Value.Value);
Expand Down

0 comments on commit 6628d53

Please sign in to comment.