From 6f16b7ca72899e2ae81f4669cdf1b10a43c692e7 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Thu, 30 Jun 2022 01:04:48 +0200 Subject: latest from desktop --- server/src/Services/VaultService.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'server/src/Services') diff --git a/server/src/Services/VaultService.cs b/server/src/Services/VaultService.cs index 6034586..f6d0ad8 100644 --- a/server/src/Services/VaultService.cs +++ b/server/src/Services/VaultService.cs @@ -15,7 +15,7 @@ public class VaultService CACHE_TTL = configuration.GetValue(AppEnvironmentVariables.VAULT_CACHE_TTL, 60 * 60 * 12); if (token.IsNullOrWhiteSpace()) throw new ApplicationException("VAULT_TOKEN is empty"); if (vaultUrl.IsNullOrWhiteSpace()) throw new ApplicationException("VAULT_URL is empty"); - client.DefaultRequestHeaders.Add(AppHeaders.VAULT_TOKEN, token); + client.DefaultRequestHeaders.Add("X-Vault-Token", token); client.BaseAddress = new Uri(vaultUrl); _client = client; _cache = cache; @@ -29,17 +29,17 @@ public class VaultService cacheEntry => { cacheEntry.AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(CACHE_TTL); var getSecretResponse = _client.GetFromJsonAsync>("/v1/kv/data/" + path).Result; - if (getSecretResponse != null) { - Log.Debug("Setting new Vault cache, " - + new { - PATH = path, - CACHE_TTL, - Data = JsonSerializer.Serialize(getSecretResponse.Data.Data) - }); - return getSecretResponse.Data.Data ?? default; + if (getSecretResponse == null) { + return default; } - return default; + Log.Debug("Setting new Vault cache, " + + new { + PATH = path, + CACHE_TTL, + Data = JsonSerializer.Serialize(getSecretResponse.Data.Data) + }); + return getSecretResponse.Data.Data ?? default; }); } -- cgit v1.3