diff options
Diffstat (limited to 'plugins/websockets/config.go')
-rw-r--r-- | plugins/websockets/config.go | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/plugins/websockets/config.go b/plugins/websockets/config.go index be4aaa82..93d9ac3b 100644 --- a/plugins/websockets/config.go +++ b/plugins/websockets/config.go @@ -7,14 +7,48 @@ import ( ) /* +# GLOBAL +redis: + addrs: + - 'localhost:6379' + websockets: # pubsubs should implement PubSub interface to be collected via endure.Collects pubsubs:["redis", "amqp", "memory"] + # OR local + redis: + addrs: + - 'localhost:6379' + # path used as websockets path path: "/ws" */ +type RedisConfig 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"` +} + // Config represents configuration for the ws plugin type Config struct { // http path for the websocket @@ -23,6 +57,8 @@ type Config struct { PubSubs []string `mapstructure:"pubsubs"` Middleware []string `mapstructure:"middleware"` + Redis *RedisConfig `mapstructure:"redis"` + Pool *pool.Config `mapstructure:"pool"` } @@ -55,4 +91,11 @@ func (c *Config) InitDefault() { } c.Pool.Supervisor.InitDefaults() } + + if c.Redis != nil { + if c.Redis.Addrs == nil { + // append default + c.Redis.Addrs = append(c.Redis.Addrs, "localhost:6379") + } + } } |