summaryrefslogtreecommitdiffstats
path: root/server/src/Services/VaultService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/Services/VaultService.cs')
-rw-r--r--server/src/Services/VaultService.cs20
1 files changed, 10 insertions, 10 deletions
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<GetSecretResponse<T>>("/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;
});
}