diff options
| author | Dan Engelbrecht <[email protected]> | 2026-04-01 13:48:19 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-04-01 13:48:19 +0200 |
| commit | af208b5612ca9945242b40be4f65e76e0a32e8fa (patch) | |
| tree | 3c9629ed3506ebb5496e41db9d915837ab3db6c7 /src/zenutil/include | |
| parent | kill stale test processes (zenserver, minio, nomad, consul) before and after ... (diff) | |
| download | zen-af208b5612ca9945242b40be4f65e76e0a32e8fa.tar.xz zen-af208b5612ca9945242b40be4f65e76e0a32e8fa.zip | |
consul env token refresh (#912)
- Improvement: Consul token is now re-read from the environment variable on every request, allowing token rotation without restarting the service
Diffstat (limited to 'src/zenutil/include')
| -rw-r--r-- | src/zenutil/include/zenutil/consul.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/zenutil/include/zenutil/consul.h b/src/zenutil/include/zenutil/consul.h index 4002d5d23..f48e5b212 100644 --- a/src/zenutil/include/zenutil/consul.h +++ b/src/zenutil/include/zenutil/consul.h @@ -28,7 +28,14 @@ struct ServiceRegistrationInfo class ConsulClient { public: - ConsulClient(std::string_view BaseUri, std::string_view Token = ""); + struct Configuration + { + std::string BaseUri; + std::string StaticToken; + std::string TokenEnvName; + }; + + ConsulClient(const Configuration& Config); ~ConsulClient(); ConsulClient(const ConsulClient&) = delete; @@ -56,8 +63,8 @@ private: static bool FindServiceInJson(std::string_view Json, std::string_view ServiceId); void ApplyCommonHeaders(HttpClient::KeyValueMap& InOutHeaderMap); - std::string m_Token; - HttpClient m_HttpClient; + Configuration m_Config; + HttpClient m_HttpClient; }; class ConsulProcess |