summaryrefslogtreecommitdiffstats
path: root/server/src/Services
diff options
context:
space:
mode:
authorivarlovlie <git@ivarlovlie.no>2022-06-30 01:04:48 +0200
committerivarlovlie <git@ivarlovlie.no>2022-06-30 01:04:48 +0200
commit6f16b7ca72899e2ae81f4669cdf1b10a43c692e7 (patch)
treed2b1e249a0a9e953316dac9bfbcd415eda893e92 /server/src/Services
parenta19e31557f6ef33ed33d694968abe7416e878c60 (diff)
downloadgreatoffice-6f16b7ca72899e2ae81f4669cdf1b10a43c692e7.tar.xz
greatoffice-6f16b7ca72899e2ae81f4669cdf1b10a43c692e7.zip
latest from desktop
Diffstat (limited to 'server/src/Services')
-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;
});
}