Merge pull request #1043 from ramonberrutti/sentinel_password

add option for sentinel password
This commit is contained in:
Vladimir Mihailenco 2019-06-04 13:57:50 +03:00 committed by GitHub
commit 9dba04507e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -29,6 +29,7 @@ type FailoverOptions struct {
OnConnect func(*Conn) error
Password string
SentinelPassword string
DB int
MaxRetries int
@ -83,6 +84,7 @@ func NewFailoverClient(failoverOpt *FailoverOptions) *Client {
failover := &sentinelFailover{
masterName: failoverOpt.MasterName,
sentinelAddrs: failoverOpt.SentinelAddrs,
password: failoverOpt.SentinelPassword,
opt: opt,
}
@ -281,6 +283,7 @@ type sentinelFailover struct {
sentinelAddrs []string
opt *Options
password string
pool *pool.ConnPool
poolOnce sync.Once
@ -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,