Skip to content

Commit

Permalink
Set default Listeners only if Listen is omited
Browse files Browse the repository at this point in the history
  • Loading branch information
Felixoid authored and Civil committed Mar 3, 2021
1 parent 72d1108 commit 23f3b57
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/carbonapi/config/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ func SetUpConfig(logger *zap.Logger, BuildVersion string) {
}
}

if len(Config.Listeners) == 0 {
Config.Listeners = append(Config.Listeners, Listener{Address: "localhost:8081"})
}

for _, define := range Config.Define {
if define.Name == "" {
logger.Fatal("empty define name")
Expand Down Expand Up @@ -321,9 +325,7 @@ func SetUpViper(logger *zap.Logger, configPath *string, viperPrefix string) {
}
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
_ = viper.BindEnv("tz", "carbonapi_tz")
viper.SetDefault("listeners", []Listener{{
Address: "localhost:8081",
}})
viper.SetDefault("listeners", []Listener{})
viper.SetDefault("concurency", 20)
viper.SetDefault("cache.type", "mem")
viper.SetDefault("cache.size_mb", 0)
Expand Down

0 comments on commit 23f3b57

Please sign in to comment.