mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-01-18 18:55:54 +08:00
Fix getRedisOptionsFromFlags helper
This commit is contained in:
parent
0eb9d88c53
commit
e942c1b0b3
24
main.go
24
main.go
@ -100,23 +100,21 @@ func getRedisOptionsFromFlags() (*redis.Options, error) {
|
||||
}
|
||||
} else {
|
||||
opts = &redis.Options{
|
||||
Addr: flagRedisAddr,
|
||||
DB: flagRedisDB,
|
||||
Password: flagRedisPassword,
|
||||
TLSConfig: &tls.Config{},
|
||||
Addr: flagRedisAddr,
|
||||
DB: flagRedisDB,
|
||||
Password: flagRedisPassword,
|
||||
}
|
||||
}
|
||||
|
||||
if tls := opts.TLSConfig; tls != nil {
|
||||
if tlsHost := flagRedisTLS; tlsHost != "" {
|
||||
tls.ServerName = tlsHost
|
||||
}
|
||||
|
||||
if flagRedisInsecureTLS {
|
||||
tls.InsecureSkipVerify = true
|
||||
}
|
||||
if flagRedisTLS != "" {
|
||||
opts.TLSConfig = &tls.Config{ServerName: flagRedisTLS}
|
||||
}
|
||||
if flagRedisInsecureTLS {
|
||||
if opts.TLSConfig == nil {
|
||||
opts.TLSConfig = &tls.Config{}
|
||||
}
|
||||
opts.TLSConfig.InsecureSkipVerify = true
|
||||
}
|
||||
|
||||
return opts, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user