From c6e879efe2b8247e9b17210e778162a488557cd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Berrutti?= Date: Sun, 2 Jun 2019 13:27:33 -0300 Subject: [PATCH] add option for sentinel password --- sentinel.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sentinel.go b/sentinel.go index bf43a165..54119819 100644 --- a/sentinel.go +++ b/sentinel.go @@ -27,8 +27,9 @@ type FailoverOptions struct { OnConnect func(*Conn) error - Password string - DB int + Password string + SentinelPassword string + DB int MaxRetries int MinRetryBackoff time.Duration @@ -82,6 +83,7 @@ func NewFailoverClient(failoverOpt *FailoverOptions) *Client { failover := &sentinelFailover{ masterName: failoverOpt.MasterName, sentinelAddrs: failoverOpt.SentinelAddrs, + password: failoverOpt.SentinelPassword, opt: opt, } @@ -275,7 +277,8 @@ func (c *SentinelClient) Remove(name string) *StringCmd { type sentinelFailover struct { sentinelAddrs []string - opt *Options + opt *Options + password string pool *pool.ConnPool poolOnce sync.Once @@ -334,6 +337,8 @@ func (c *sentinelFailover) masterAddr() (string, error) { sentinel := NewSentinelClient(&Options{ Addr: sentinelAddr, + Password: c.password, + MaxRetries: c.opt.MaxRetries, DialTimeout: c.opt.DialTimeout,