Skip to content

Commit 522d281

Browse files
committed
Merge branch 'main' of github.com:soxft/busuanzi
2 parents 46cff97 + c03c806 commit 522d281

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

process/redisutil/redisutil.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package redisutil
22

33
import (
44
"context"
5+
"crypto/tls"
56
"github.com/redis/go-redis/v9"
67
"github.com/soxft/busuanzi/config"
78

@@ -16,10 +17,19 @@ func Init() {
1617

1718
r := config.Redis
1819

20+
var tlsConfig *tls.Config
21+
22+
if r.TLS {
23+
tlsConfig = &tls.Config{
24+
MinVersion: tls.VersionTLS12,
25+
}
26+
}
27+
1928
rdb := redis.NewClient(&redis.Options{
2029
Addr: r.Address,
2130
Password: r.Password,
2231
DB: r.Database,
32+
TLSConfig: tlsConfig,
2333
MinIdleConns: r.MinIdle,
2434
MaxIdleConns: r.MaxIdle,
2535
MaxRetries: r.MaxRetries,

0 commit comments

Comments
 (0)