From 89c473aac769b7e5d33f3b81edfa82b04f896d1d Mon Sep 17 00:00:00 2001 From: Juan Calderon-Perez Date: Sat, 9 Sep 2023 21:32:28 -0400 Subject: [PATCH] Use Redis Options TLSConfig if returned --- redis/redis.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/redis/redis.go b/redis/redis.go index ec555a06..c61f37c7 100644 --- a/redis/redis.go +++ b/redis/redis.go @@ -33,6 +33,11 @@ func New(config ...Config) *Storage { cfg.Password = options.Password cfg.Database = options.DB cfg.Addrs = []string{options.Addr} + + // If cfg.TLSConfig is not provided, and options returns one, use it. + if cfg.TLSConfig == nil && options.TLSConfig != nil { + cfg.TLSConfig = options.TLSConfig + } } else if len(cfg.Addrs) == 0 { // Fallback to Host and Port values if Addrs is empty cfg.Addrs = []string{fmt.Sprintf("%s:%d", cfg.Host, cfg.Port)}