mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2026-09-30 03:31:27 +02:00
fix: dont override parameters set in redis uri
Signed-off-by: Richard Hagen <richard.hagen@gmail.com>
This commit is contained in:
@@ -109,6 +109,9 @@ func buildSentinelClient(opts options.RedisStoreOptions) (Client, error) {
|
||||
if opts.Username != "" {
|
||||
opt.Username = opts.Username
|
||||
}
|
||||
if opts.IdleTimeout > 0 {
|
||||
opt.ConnMaxIdleTime = time.Duration(opts.IdleTimeout) * time.Second
|
||||
}
|
||||
|
||||
if err := setupTLSConfig(opts, opt); err != nil {
|
||||
return nil, err
|
||||
@@ -118,10 +121,10 @@ func buildSentinelClient(opts options.RedisStoreOptions) (Client, error) {
|
||||
MasterName: opts.SentinelMasterName,
|
||||
SentinelAddrs: addrs,
|
||||
SentinelPassword: opts.SentinelPassword,
|
||||
Username: opts.Username,
|
||||
Password: opts.Password,
|
||||
Username: opt.Username,
|
||||
Password: opt.Password,
|
||||
TLSConfig: opt.TLSConfig,
|
||||
ConnMaxIdleTime: time.Duration(opts.IdleTimeout) * time.Second,
|
||||
ConnMaxIdleTime: opt.ConnMaxIdleTime,
|
||||
})
|
||||
return newClient(client), nil
|
||||
}
|
||||
@@ -139,6 +142,9 @@ func buildClusterClient(opts options.RedisStoreOptions) (Client, error) {
|
||||
if opts.Username != "" {
|
||||
opt.Username = opts.Username
|
||||
}
|
||||
if opts.IdleTimeout > 0 {
|
||||
opt.ConnMaxIdleTime = time.Duration(opts.IdleTimeout) * time.Second
|
||||
}
|
||||
|
||||
if err := setupTLSConfig(opts, opt); err != nil {
|
||||
return nil, err
|
||||
@@ -146,10 +152,10 @@ func buildClusterClient(opts options.RedisStoreOptions) (Client, error) {
|
||||
|
||||
client := redis.NewClusterClient(&redis.ClusterOptions{
|
||||
Addrs: addrs,
|
||||
Username: opts.Username,
|
||||
Password: opts.Password,
|
||||
Username: opt.Username,
|
||||
Password: opt.Password,
|
||||
TLSConfig: opt.TLSConfig,
|
||||
ConnMaxIdleTime: time.Duration(opts.IdleTimeout) * time.Second,
|
||||
ConnMaxIdleTime: opt.ConnMaxIdleTime,
|
||||
})
|
||||
return newClusterClient(client), nil
|
||||
}
|
||||
@@ -168,13 +174,14 @@ func buildStandaloneClient(opts options.RedisStoreOptions) (Client, error) {
|
||||
if opts.Username != "" {
|
||||
opt.Username = opts.Username
|
||||
}
|
||||
if opts.IdleTimeout > 0 {
|
||||
opt.ConnMaxIdleTime = time.Duration(opts.IdleTimeout) * time.Second
|
||||
}
|
||||
|
||||
if err := setupTLSConfig(opts, opt); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
opt.ConnMaxIdleTime = time.Duration(opts.IdleTimeout) * time.Second
|
||||
|
||||
client := redis.NewClient(opt)
|
||||
return newClient(client), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user