Skip to content

Commit

Permalink
Use Redis Options TLSConfig if returned
Browse files Browse the repository at this point in the history
  • Loading branch information
gaby committed Sep 10, 2023
1 parent 0e55883 commit 89c473a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
Expand Down

0 comments on commit 89c473a

Please sign in to comment.