Skip to content

Commit fd22c47

Browse files
author
Vadim Belov
committed
Stricter validation for custom serverUrlKey in config
When throwIfError is true and a custom serverUrlKey is missing, throw ArgumentException immediately instead of falling back to "Vault:ApiUrl". This enforces stricter validation for custom keys.
1 parent f1c9179 commit fd22c47

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Sources/EasyVault.SDK/Extensions/ConfigurationExtensions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ public static IConfigurationManager AddSecrets(this IConfigurationManager config
5959
string? serverUrl = configuration[serverUrlKey];
6060
if (string.IsNullOrWhiteSpace(serverUrl))
6161
{
62+
if (serverUrlKey != DefaultServerUrlKey && throwIfError)
63+
{
64+
throw new ArgumentException(serverUrlKey, $"Configuration key '{serverUrlKey}' is not set.");
65+
}
6266
serverUrl = configuration["Vault:ApiUrl"];
6367
}
6468
if (string.IsNullOrWhiteSpace(serverUrl))

0 commit comments

Comments
 (0)