From 462c6fdee26c38c581ac74dd6a31902168ff99cf Mon Sep 17 00:00:00 2001 From: zeripath Date: Mon, 3 May 2021 22:30:30 +0100 Subject: [PATCH] Fix setting redis db path (#15698) (#15708) Backport #15698 There is a bug setting the redis db in the common nosql manager whereby the db path always fails. This PR fixes this. Signed-off-by: Andrew Thornton --- modules/nosql/manager_redis.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/nosql/manager_redis.go b/modules/nosql/manager_redis.go index d754a0e07d..b4852cecc8 100644 --- a/modules/nosql/manager_redis.go +++ b/modules/nosql/manager_redis.go @@ -152,7 +152,7 @@ func (m *Manager) GetRedisClient(connection string) redis.UniversalClient { opts.Addrs = append(opts.Addrs, strings.Split(uri.Host, ",")...) } if uri.Path != "" { - if db, err := strconv.Atoi(uri.Path); err == nil { + if db, err := strconv.Atoi(uri.Path[1:]); err == nil { opts.DB = db } } @@ -168,7 +168,7 @@ func (m *Manager) GetRedisClient(connection string) redis.UniversalClient { opts.Addrs = append(opts.Addrs, strings.Split(uri.Host, ",")...) } if uri.Path != "" { - if db, err := strconv.Atoi(uri.Path); err == nil { + if db, err := strconv.Atoi(uri.Path[1:]); err == nil { opts.DB = db } } @@ -186,7 +186,7 @@ func (m *Manager) GetRedisClient(connection string) redis.UniversalClient { opts.Addrs = append(opts.Addrs, strings.Split(uri.Host, ",")...) } if uri.Path != "" { - if db, err := strconv.Atoi(uri.Path); err == nil { + if db, err := strconv.Atoi(uri.Path[1:]); err == nil { opts.DB = db } } -- 2.39.5