summaryrefslogtreecommitdiff
path: root/plugins/kv/drivers/redis/config.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-04-23 12:11:24 +0300
committerGitHub <[email protected]>2021-04-23 12:11:24 +0300
commit22ee906083a3f219871a3ef1f9eb1983f8f4975c (patch)
treeddd08397c74cfc6120e6174864a7a3ef7ca38771 /plugins/kv/drivers/redis/config.go
parente1e168da92e0dca0e067e08ecb4cf264b9344d45 (diff)
parent6c55cb6e2d554dfbffe1ce2eedaad3d34202e1bd (diff)
#643 feat(kv): kv plugin stabilization
#643 feat(kv): kv plugin stabilization
Diffstat (limited to 'plugins/kv/drivers/redis/config.go')
-rw-r--r--plugins/kv/drivers/redis/config.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/plugins/kv/drivers/redis/config.go b/plugins/kv/drivers/redis/config.go
new file mode 100644
index 00000000..41348236
--- /dev/null
+++ b/plugins/kv/drivers/redis/config.go
@@ -0,0 +1,34 @@
+package redis
+
+import "time"
+
+type Config struct {
+ Addrs []string `mapstructure:"addrs"`
+ DB int `mapstructure:"db"`
+ Username string `mapstructure:"username"`
+ Password string `mapstructure:"password"`
+ MasterName string `mapstructure:"master_name"`
+ SentinelPassword string `mapstructure:"sentinel_password"`
+ RouteByLatency bool `mapstructure:"route_by_latency"`
+ RouteRandomly bool `mapstructure:"route_randomly"`
+ MaxRetries int `mapstructure:"max_retries"`
+ DialTimeout time.Duration `mapstructure:"dial_timeout"`
+ MinRetryBackoff time.Duration `mapstructure:"min_retry_backoff"`
+ MaxRetryBackoff time.Duration `mapstructure:"max_retry_backoff"`
+ PoolSize int `mapstructure:"pool_size"`
+ MinIdleConns int `mapstructure:"min_idle_conns"`
+ MaxConnAge time.Duration `mapstructure:"max_conn_age"`
+ ReadTimeout time.Duration `mapstructure:"read_timeout"`
+ WriteTimeout time.Duration `mapstructure:"write_timeout"`
+ PoolTimeout time.Duration `mapstructure:"pool_timeout"`
+ IdleTimeout time.Duration `mapstructure:"idle_timeout"`
+ IdleCheckFreq time.Duration `mapstructure:"idle_check_freq"`
+ ReadOnly bool `mapstructure:"read_only"`
+}
+
+// InitDefaults initializing fill config with default values
+func (s *Config) InitDefaults() {
+ if s.Addrs == nil {
+ s.Addrs = []string{"localhost:6379"} // default addr is pointing to local storage
+ }
+}