Skip to content

Commit

Permalink
Merge pull request redis#1043 from ramonberrutti/sentinel_password
Browse files Browse the repository at this point in the history
add option for sentinel password
  • Loading branch information
vmihailenco authored Jun 4, 2019
2 parents c41450a + c6e879e commit 9dba045
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions sentinel.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ type FailoverOptions struct {
Dialer func(network, addr string) (net.Conn, error)
OnConnect func(*Conn) error

Password string
DB int
Password string
SentinelPassword string
DB int

MaxRetries int
MinRetryBackoff time.Duration
Expand Down Expand Up @@ -83,6 +84,7 @@ func NewFailoverClient(failoverOpt *FailoverOptions) *Client {
failover := &sentinelFailover{
masterName: failoverOpt.MasterName,
sentinelAddrs: failoverOpt.SentinelAddrs,
password: failoverOpt.SentinelPassword,

opt: opt,
}
Expand Down Expand Up @@ -280,7 +282,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
Expand Down Expand Up @@ -339,6 +342,8 @@ func (c *sentinelFailover) masterAddr() (string, error) {
sentinel := NewSentinelClient(&Options{
Addr: sentinelAddr,

Password: c.password,

MaxRetries: c.opt.MaxRetries,

DialTimeout: c.opt.DialTimeout,
Expand Down

0 comments on commit 9dba045

Please sign in to comment.