refactor: remove redis direct references from proxy/admin servers
This commit is contained in:
@ -14,7 +14,7 @@ import (
|
||||
type BootstrapConfig struct {
|
||||
Proxies map[store.ProxyName]BootstrapProxyConfig `yaml:"proxies"`
|
||||
Dir InterpolatedString `yaml:"dir"`
|
||||
LockTimeout InterpolatedDuration `yaml:"lockTimeout"`
|
||||
LockTimeout *InterpolatedDuration `yaml:"lockTimeout"`
|
||||
MaxConnectionRetries InterpolatedInt `yaml:"maxRetries"`
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ type BootstrapLayerConfig struct {
|
||||
func NewDefaultBootstrapConfig() BootstrapConfig {
|
||||
return BootstrapConfig{
|
||||
Dir: "",
|
||||
LockTimeout: *NewInterpolatedDuration(30 * time.Second),
|
||||
LockTimeout: NewInterpolatedDuration(30 * time.Second),
|
||||
MaxConnectionRetries: 10,
|
||||
}
|
||||
}
|
||||
|
@ -220,3 +220,11 @@ func NewInterpolatedDuration(d time.Duration) *InterpolatedDuration {
|
||||
id := InterpolatedDuration(d)
|
||||
return &id
|
||||
}
|
||||
|
||||
func Default[T any](value *T, defaultValue *T) *T {
|
||||
if value == nil {
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
@ -16,18 +16,18 @@ func NewDefaultIntegrationsConfig() IntegrationsConfig {
|
||||
PrivateKeySecret: "",
|
||||
PrivateKeySecretNamespace: "",
|
||||
ReaderTokenSecret: "",
|
||||
LockTimeout: *NewInterpolatedDuration(30 * time.Second),
|
||||
LockTimeout: NewInterpolatedDuration(30 * time.Second),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type KubernetesConfig struct {
|
||||
Enabled InterpolatedBool `yaml:"enabled"`
|
||||
WriterTokenSecret InterpolatedString `yaml:"writerTokenSecret"`
|
||||
WriterTokenSecretNamespace InterpolatedString `yaml:"writerTokenSecretNamespace"`
|
||||
ReaderTokenSecret InterpolatedString `yaml:"readerTokenSecret"`
|
||||
ReaderTokenSecretNamespace InterpolatedString `yaml:"readerTokenSecretNamespace"`
|
||||
PrivateKeySecret InterpolatedString `yaml:"privateKeySecret"`
|
||||
PrivateKeySecretNamespace InterpolatedString `yaml:"privateKeySecretNamespace"`
|
||||
LockTimeout InterpolatedDuration `yaml:"lockTimeout"`
|
||||
Enabled InterpolatedBool `yaml:"enabled"`
|
||||
WriterTokenSecret InterpolatedString `yaml:"writerTokenSecret"`
|
||||
WriterTokenSecretNamespace InterpolatedString `yaml:"writerTokenSecretNamespace"`
|
||||
ReaderTokenSecret InterpolatedString `yaml:"readerTokenSecret"`
|
||||
ReaderTokenSecretNamespace InterpolatedString `yaml:"readerTokenSecretNamespace"`
|
||||
PrivateKeySecret InterpolatedString `yaml:"privateKeySecret"`
|
||||
PrivateKeySecretNamespace InterpolatedString `yaml:"privateKeySecretNamespace"`
|
||||
LockTimeout *InterpolatedDuration `yaml:"lockTimeout"`
|
||||
}
|
||||
|
@ -11,33 +11,36 @@ const (
|
||||
type RedisConfig struct {
|
||||
Adresses InterpolatedStringSlice `yaml:"addresses"`
|
||||
Master InterpolatedString `yaml:"master"`
|
||||
ReadTimeout InterpolatedDuration `yaml:"readTimeout"`
|
||||
WriteTimeout InterpolatedDuration `yaml:"writeTimeout"`
|
||||
DialTimeout InterpolatedDuration `yaml:"dialTimeout"`
|
||||
ReadTimeout *InterpolatedDuration `yaml:"readTimeout"`
|
||||
WriteTimeout *InterpolatedDuration `yaml:"writeTimeout"`
|
||||
DialTimeout *InterpolatedDuration `yaml:"dialTimeout"`
|
||||
LockMaxRetries InterpolatedInt `yaml:"lockMaxRetries"`
|
||||
RouteByLatency InterpolatedBool `yaml:"routeByLatency"`
|
||||
ContextTimeoutEnabled InterpolatedBool `yaml:"contextTimeoutEnabled"`
|
||||
MaxRetries InterpolatedInt `yaml:"maxRetries"`
|
||||
PingInterval InterpolatedDuration `yaml:"pingInterval"`
|
||||
PingInterval *InterpolatedDuration `yaml:"pingInterval"`
|
||||
PoolSize InterpolatedInt `yaml:"poolSize"`
|
||||
PoolTimeout InterpolatedDuration `yaml:"poolTimeout"`
|
||||
PoolTimeout *InterpolatedDuration `yaml:"poolTimeout"`
|
||||
MinIdleConns InterpolatedInt `yaml:"minIdleConns"`
|
||||
MaxIdleConns InterpolatedInt `yaml:"maxIdleConns"`
|
||||
ConnMaxIdleTime InterpolatedDuration `yaml:"connMaxIdleTime"`
|
||||
ConnMaxLifetime InterpolatedDuration `yaml:"connMaxLifeTime"`
|
||||
ConnMaxIdleTime *InterpolatedDuration `yaml:"connMaxIdleTime"`
|
||||
ConnMaxLifetime *InterpolatedDuration `yaml:"connMaxLifeTime"`
|
||||
}
|
||||
|
||||
func NewDefaultRedisConfig() RedisConfig {
|
||||
return RedisConfig{
|
||||
Adresses: InterpolatedStringSlice{"localhost:6379"},
|
||||
Master: "",
|
||||
ReadTimeout: InterpolatedDuration(30 * time.Second),
|
||||
WriteTimeout: InterpolatedDuration(30 * time.Second),
|
||||
DialTimeout: InterpolatedDuration(30 * time.Second),
|
||||
ReadTimeout: NewInterpolatedDuration(30 * time.Second),
|
||||
WriteTimeout: NewInterpolatedDuration(30 * time.Second),
|
||||
DialTimeout: NewInterpolatedDuration(30 * time.Second),
|
||||
PoolTimeout: NewInterpolatedDuration(31 * time.Second),
|
||||
LockMaxRetries: 10,
|
||||
MaxRetries: 3,
|
||||
PingInterval: InterpolatedDuration(30 * time.Second),
|
||||
PingInterval: NewInterpolatedDuration(30 * time.Second),
|
||||
ContextTimeoutEnabled: true,
|
||||
RouteByLatency: true,
|
||||
ConnMaxIdleTime: NewInterpolatedDuration(1 * time.Minute),
|
||||
ConnMaxLifetime: NewInterpolatedDuration(5 * time.Minute),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user