always use multi-node when Redis is provided, removed config

This commit is contained in:
David Zhao
2021-01-30 13:29:31 -08:00
parent 5ce52b6a30
commit 1a8e26031f
5 changed files with 12 additions and 37 deletions
+7 -6
View File
@@ -16,8 +16,6 @@ type Config struct {
Keys map[string]string `yaml:"keys"`
LogLevel string `yaml:"log_level"`
// multi-node configuration,
MultiNode bool `yaml:"multi_node"`
Development bool `yaml:"development"`
}
@@ -47,10 +45,8 @@ func NewConfig(confString string) (*Config, error) {
"stun.l.google.com:19302",
},
},
Redis: RedisConfig{
Address: "localhost:6379",
},
Keys: map[string]string{},
Redis: RedisConfig{},
Keys: map[string]string{},
}
if confString != "" {
yaml.Unmarshal([]byte(confString), conf)
@@ -58,6 +54,10 @@ func NewConfig(confString string) (*Config, error) {
return conf, nil
}
func (conf *Config) HasRedis() bool {
return conf.Redis.Address != ""
}
func (conf *Config) UpdateFromCLI(c *cli.Context) error {
if c.IsSet("dev") {
conf.Development = c.Bool("dev")
@@ -82,6 +82,7 @@ func (conf *Config) UpdateFromCLI(c *cli.Context) error {
return err
}
conf.KeyFile = file
return nil
}