diff --git a/common/config/models_main.go b/common/config/models_main.go index fcd043a6..47d21b44 100644 --- a/common/config/models_main.go +++ b/common/config/models_main.go @@ -81,9 +81,11 @@ type SentryConfig struct { } type RedisConfig struct { - Enabled bool `yaml:"enabled"` - Shards []RedisShardConfig `yaml:"shards,flow"` - DbNum int `default:"0" yaml:"databaseNumber"` + Enabled bool `yaml:"enabled"` + Shards []RedisShardConfig `yaml:"shards,flow"` + DbNum int `default:"0" yaml:"databaseNumber"` + Username string `default:"" yaml:"user"` + Password string `default:"" yaml:"password"` } type RedisShardConfig struct { diff --git a/redislib/connection.go b/redislib/connection.go index 50a38bb7..778b09ca 100644 --- a/redislib/connection.go +++ b/redislib/connection.go @@ -34,6 +34,8 @@ func makeConnection() { client := redis.NewClient(&redis.Options{ DialTimeout: 10 * time.Second, DB: conf.DbNum, + Username: conf.Username, + Password: conf.Password, Addr: c.Address, }) clients = append(clients, client) @@ -43,6 +45,8 @@ func makeConnection() { Addrs: addresses, DialTimeout: 10 * time.Second, DB: conf.DbNum, + Username: conf.Username, + Password: conf.Password, }) rs = redsync.New(pools...) })