Skip to content

Commit

Permalink
fix(go-redis): support TLS configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
darkweak committed Oct 25, 2024
1 parent e514823 commit ba5e199
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions go-redis/go-redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package redis
import (
"bytes"
"context"
"crypto/tls"
"encoding/json"
"errors"
"fmt"
Expand Down Expand Up @@ -51,6 +52,20 @@ func Factory(redisConfiguration core.CacheProvider, logger core.Logger, stale ti
hashtags = v
}
}

if value, ok := redisConfig["TLSConfig"]; ok {
tlsConfigBytes, err := json.Marshal(value)
if err != nil {
return nil, err
}

var tlsConfig tls.Config
if err = json.Unmarshal(tlsConfigBytes, &tlsConfig); err != nil {
return nil, err
}

options.TLSConfig = &tlsConfig
}
}
} else {
options = redis.UniversalOptions{
Expand Down

0 comments on commit ba5e199

Please sign in to comment.