diff --git a/src/Dapr.Extensions.Configuration/DaprSecretStoreConfigurationExtensions.cs b/src/Dapr.Extensions.Configuration/DaprSecretStoreConfigurationExtensions.cs index 5867f694..04251101 100644 --- a/src/Dapr.Extensions.Configuration/DaprSecretStoreConfigurationExtensions.cs +++ b/src/Dapr.Extensions.Configuration/DaprSecretStoreConfigurationExtensions.cs @@ -89,12 +89,18 @@ namespace Dapr.Extensions.Configuration ArgumentVerifier.ThrowIfNullOrEmpty(store, nameof(store)); ArgumentVerifier.ThrowIfNull(client, nameof(client)); - configurationBuilder.Add(new DaprSecretStoreConfigurationSource() + var source = new DaprSecretStoreConfigurationSource { Store = store, - KeyDelimiters = keyDelimiters?.ToList(), Client = client - }); + }; + + if (keyDelimiters != null) + { + source.KeyDelimiters = keyDelimiters.ToList(); + } + + configurationBuilder.Add(source); return configurationBuilder; } diff --git a/src/Dapr.Extensions.Configuration/DaprSecretStoreConfigurationSource.cs b/src/Dapr.Extensions.Configuration/DaprSecretStoreConfigurationSource.cs index 72e3c2cd..be2c4748 100644 --- a/src/Dapr.Extensions.Configuration/DaprSecretStoreConfigurationSource.cs +++ b/src/Dapr.Extensions.Configuration/DaprSecretStoreConfigurationSource.cs @@ -18,7 +18,7 @@ namespace Dapr.Extensions.Configuration.DaprSecretStore /// /// Gets or sets the store name. /// - public string? Store { get; set; } + public string Store { get; set; } = string.Empty; /// /// Gets or sets a value indicating whether any key delimiters should be replaced with the delimiter ":". @@ -29,7 +29,7 @@ namespace Dapr.Extensions.Configuration.DaprSecretStore /// /// Gets or sets the custom key delimiters. Contains the '__' delimiter by default. /// - public IList? KeyDelimiters { get; set; } = new List { "__" }; + public IList KeyDelimiters { get; set; } = new List { "__" }; /// /// Gets or sets the secret descriptors. @@ -44,7 +44,7 @@ namespace Dapr.Extensions.Configuration.DaprSecretStore /// /// Gets or sets the http client. /// - public DaprClient? Client { get; set; } + public DaprClient Client { get; set; } = default!; /// public IConfigurationProvider Build(IConfigurationBuilder builder) @@ -56,11 +56,11 @@ namespace Dapr.Extensions.Configuration.DaprSecretStore throw new ArgumentException($"{nameof(Metadata)} must be null when {nameof(SecretDescriptors)} is set", nameof(Metadata)); } - return new DaprSecretStoreConfigurationProvider(Store!, NormalizeKey, KeyDelimiters, SecretDescriptors, Client!); + return new DaprSecretStoreConfigurationProvider(Store, NormalizeKey, KeyDelimiters, SecretDescriptors, Client); } else { - return new DaprSecretStoreConfigurationProvider(Store!, NormalizeKey, KeyDelimiters, Metadata, Client!); + return new DaprSecretStoreConfigurationProvider(Store, NormalizeKey, KeyDelimiters, Metadata, Client); } } }