Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional redis authorization (#562) #563

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions common/config/models_main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions redislib/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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...)
})
Expand Down