Skip to content

Commit

Permalink
fix: add redis sentinel pass option
Browse files Browse the repository at this point in the history
  • Loading branch information
robcxyz committed Sep 19, 2024
1 parent 26a79c7 commit 71de015
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ type configType struct {
RedisPassword string `envconfig:"REDIS_PASSWORD" required:"false" default:""`
RedisSentinelClientMode bool `envconfig:"REDIS_SENTINEL_CLIENT_MODE" required:"false" default:"false"`
RedisSentinelClientMasterName string `envconfig:"REDIS_SENTINEL_CLIENT_MASTER_NAME" required:"false" default:"master"`
RedisSentinelPassword string `envconfig:"REDIS_SENTINEL_PASSWORD" required:"false" default:""`
RedisKeyPrefix string `envconfig:"REDIS_KEY_PREFIX" required:"false" default:"icon_"`

// Redis Channels
Expand Down
5 changes: 3 additions & 2 deletions src/redis/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ func GetRedisClient() *Client {
} else {
// Use sentinel client
redisClient.client = redis.NewFailoverClient(&redis.FailoverOptions{
MasterName: config.Config.RedisSentinelClientMasterName,
SentinelAddrs: []string{addr},
MasterName: config.Config.RedisSentinelClientMasterName,
SentinelAddrs: []string{addr},
SentinelPassword: config.Config.RedisSentinelPassword,
})
}

Expand Down

0 comments on commit 71de015

Please sign in to comment.