Skip to content

Commit

Permalink
Update redis lock connection string parsing. (#656)
Browse files Browse the repository at this point in the history
  • Loading branch information
hardlyknowem authored Feb 11, 2021
1 parent 5e7a071 commit 37c6ee5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions v1/locks/redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ func New(cnf *config.Config, addrs []string, db, retries int) Lock {

var password string

i := strings.LastIndex(addrs[0], "@")
if i > 0 {
// with passwrod
password = addrs[0][i+1:]
addrs[0] = addrs[0][:i]
parts := strings.Split(addrs[0], "@")
if len(parts) == 2 {
password = parts[0]
addrs[0] = parts[1]
}

ropt := &redis.UniversalOptions{
Expand Down

0 comments on commit 37c6ee5

Please sign in to comment.