Skip to content

Commit 1f17e71

Browse files
authored
Parse redis backend url (#804)
As suggested by the go-redis client, parse the url to get the config. This will fix problems, when the url contains a username and/or password. Fixes #798 Signed-off-by: Christian Zunker <[email protected]>
1 parent 0954f6b commit 1f17e71

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

internal/operation/operation.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ type Cache struct {
3232
func NewCache(backend string) (Cache, error) {
3333
if strings.HasPrefix(backend, "redis://") {
3434
log.Logger.Infof("Redis cache: %s", backend)
35-
redisCache := cache.NewRedisCache(&redis.Options{
36-
Addr: strings.TrimPrefix(backend, "redis://"),
37-
})
35+
options, err := redis.ParseURL(backend)
36+
if err != nil {
37+
return Cache{}, err
38+
}
39+
redisCache := cache.NewRedisCache(options)
3840
return Cache{Cache: redisCache}, nil
3941
}
4042
fsCache, err := cache.NewFSCache(utils.CacheDir())

0 commit comments

Comments
 (0)