From ca419707e4de72756d8e4cb0501025b6c5ca797c Mon Sep 17 00:00:00 2001 From: Tiago Peczenyj Date: Thu, 21 Sep 2023 14:25:05 +0200 Subject: [PATCH 1/2] must propagage missing fields Signed-off-by: Tiago Peczenyj --- options.go | 2 +- ring.go | 18 ++++++++++++++++-- sentinel.go | 4 ++++ universal.go | 8 ++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/options.go b/options.go index ba65defd2..26d3641cd 100644 --- a/options.go +++ b/options.go @@ -142,7 +142,7 @@ type Options struct { // Enables read only queries on slave/follower nodes. readOnly bool - // // Disable set-lib on connect. Default is false. + // Disable set-lib on connect. Default is false. DisableIndentity bool } diff --git a/ring.go b/ring.go index 7cf09111b..150c6183d 100644 --- a/ring.go +++ b/ring.go @@ -73,7 +73,10 @@ type RingOptions struct { Protocol int Username string Password string - DB int + + CredentialsProvider func() (username string, password string) + + DB int MaxRetries int MinRetryBackoff time.Duration @@ -83,6 +86,8 @@ type RingOptions struct { ReadTimeout time.Duration WriteTimeout time.Duration + ContextTimeoutEnabled bool + // PoolFIFO uses FIFO mode for each node connection pool GET/PUT (default LIFO). PoolFIFO bool @@ -95,6 +100,8 @@ type RingOptions struct { TLSConfig *tls.Config Limiter Limiter + + DisableIndentity bool } func (opt *RingOptions) init() { @@ -140,7 +147,10 @@ func (opt *RingOptions) clientOptions() *Options { Protocol: opt.Protocol, Username: opt.Username, Password: opt.Password, - DB: opt.DB, + + CredentialsProvider: opt.CredentialsProvider, + + DB: opt.DB, MaxRetries: -1, @@ -148,6 +158,8 @@ func (opt *RingOptions) clientOptions() *Options { ReadTimeout: opt.ReadTimeout, WriteTimeout: opt.WriteTimeout, + ContextTimeoutEnabled: opt.ContextTimeoutEnabled, + PoolFIFO: opt.PoolFIFO, PoolSize: opt.PoolSize, PoolTimeout: opt.PoolTimeout, @@ -158,6 +170,8 @@ func (opt *RingOptions) clientOptions() *Options { TLSConfig: opt.TLSConfig, Limiter: opt.Limiter, + + DisableIndentity: opt.DisableIndentity, } } diff --git a/sentinel.go b/sentinel.go index dbff40603..0b4d90957 100644 --- a/sentinel.go +++ b/sentinel.go @@ -78,6 +78,8 @@ type FailoverOptions struct { ConnMaxLifetime time.Duration TLSConfig *tls.Config + + DisableIndentity bool } func (opt *FailoverOptions) clientOptions() *Options { @@ -111,6 +113,8 @@ func (opt *FailoverOptions) clientOptions() *Options { ConnMaxLifetime: opt.ConnMaxLifetime, TLSConfig: opt.TLSConfig, + + DisableIndentity: opt.DisableIndentity, } } diff --git a/universal.go b/universal.go index 53ece1856..782b980d1 100644 --- a/universal.go +++ b/universal.go @@ -64,6 +64,8 @@ type UniversalOptions struct { // Only failover clients. MasterName string + + DisableIndentity bool } // Cluster returns cluster options created from the universal options. @@ -106,6 +108,8 @@ func (o *UniversalOptions) Cluster() *ClusterOptions { ConnMaxLifetime: o.ConnMaxLifetime, TLSConfig: o.TLSConfig, + + DisableIndentity: o.DisableIndentity, } } @@ -148,6 +152,8 @@ func (o *UniversalOptions) Failover() *FailoverOptions { ConnMaxLifetime: o.ConnMaxLifetime, TLSConfig: o.TLSConfig, + + DisableIndentity: o.DisableIndentity, } } @@ -187,6 +193,8 @@ func (o *UniversalOptions) Simple() *Options { ConnMaxLifetime: o.ConnMaxLifetime, TLSConfig: o.TLSConfig, + + DisableIndentity: o.DisableIndentity, } } From 522edfe590181aa4e49d0620776ed4f1c550a9a9 Mon Sep 17 00:00:00 2001 From: Tiago Peczenyj Date: Thu, 21 Sep 2023 14:26:42 +0200 Subject: [PATCH 2/2] remove credentials provider from ring --- ring.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/ring.go b/ring.go index 150c6183d..57be16086 100644 --- a/ring.go +++ b/ring.go @@ -73,10 +73,7 @@ type RingOptions struct { Protocol int Username string Password string - - CredentialsProvider func() (username string, password string) - - DB int + DB int MaxRetries int MinRetryBackoff time.Duration @@ -147,10 +144,7 @@ func (opt *RingOptions) clientOptions() *Options { Protocol: opt.Protocol, Username: opt.Username, Password: opt.Password, - - CredentialsProvider: opt.CredentialsProvider, - - DB: opt.DB, + DB: opt.DB, MaxRetries: -1,