From aa67bf5591b8739202480c4a14078c36c64b057d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20Fr=C3=B6hlich?= Date: Sat, 5 Aug 2023 00:03:29 +0200 Subject: [PATCH 1/2] Change init of consul client to respect TLS --- kv/consul/client.go | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/kv/consul/client.go b/kv/consul/client.go index 5501a67d8..0440fa393 100644 --- a/kv/consul/client.go +++ b/kv/consul/client.go @@ -6,7 +6,6 @@ import ( "flag" "fmt" "math/rand" - "net/http" "time" "github.com/go-kit/log" @@ -84,16 +83,16 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet, prefix string) { // NewClient returns a new Client. func NewClient(cfg Config, codec codec.Codec, logger log.Logger, registerer prometheus.Registerer) (*Client, error) { - client, err := consul.NewClient(&consul.Config{ - Address: cfg.Host, - Token: cfg.ACLToken.String(), - Scheme: "http", - HttpClient: &http.Client{ - Transport: cleanhttp.DefaultPooledTransport(), - // See https://blog.cloudflare.com/the-complete-guide-to-golang-net-http-timeouts/ - Timeout: cfg.HTTPClientTimeout, - }, - }) + config := &consul.Config{ + Address: cfg.Host, + Token: cfg.ACLToken.String(), + Scheme: "http", + Transport: cleanhttp.DefaultPooledTransport(), + } + client, err := consul.NewClient(config) + // See https://blog.cloudflare.com/the-complete-guide-to-golang-net-http-timeouts/ + config.HttpClient.Timeout = cfg.HTTPClientTimeout + if err != nil { return nil, err } From 68193ff7619a44e8bd8b99d26a55787af7b8f690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20Fr=C3=B6hlich?= Date: Sat, 5 Aug 2023 00:29:27 +0200 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7758f6c7..eed4ff4ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Changelog +* [CHANGE] Change initialisation of consul client to respect TLS specific environemnt variables. #345 * [CHANGE] Change `WaitRingStability` and `WaitInstanceState` methods signature to rely on `ReadRing` instead. #251 * [CHANGE] Added new `-consul.cas-retry-delay` flag. It has a default value of `1s`, while previously there was no delay between retries. #178 * [CHANGE] Flagext: `DayValue` now always uses UTC when parsing or displaying dates. #71