Add support for Redis Sentinel (#707)

This commit is contained in:
Brint E. Kriebel
2022-05-28 10:26:58 -07:00
committed by GitHub
parent 80f8bc6c62
commit 5a74c1695d
6 changed files with 91 additions and 44 deletions
+14 -6
View File
@@ -119,11 +119,15 @@ type VideoConfig struct {
}
type RedisConfig struct {
Address string `yaml:"address"`
Username string `yaml:"username"`
Password string `yaml:"password"`
DB int `yaml:"db"`
UseTLS bool `yaml:"use_tls"`
Address string `yaml:"address"`
Username string `yaml:"username"`
Password string `yaml:"password"`
DB int `yaml:"db"`
UseTLS bool `yaml:"use_tls"`
MasterName string `yaml:"sentinel_master_name"`
SentinelUsername string `yaml:"sentinel_username"`
SentinelPassword string `yaml:"sentinel_password"`
SentinelAddresses []string `yaml:"sentinel_addresses"`
}
type RoomConfig struct {
@@ -289,7 +293,11 @@ func NewConfig(confString string, c *cli.Context) (*Config, error) {
}
func (conf *Config) HasRedis() bool {
return conf.Redis.Address != ""
return conf.Redis.Address != "" || conf.Redis.SentinelAddresses != nil
}
func (conf *Config) UseSentinel() bool {
return conf.Redis.SentinelAddresses != nil
}
func (conf *Config) updateFromCLI(c *cli.Context) error {