Skip to content

Commit

Permalink
hotfix: removed need for labels.yaml (#63)
Browse files Browse the repository at this point in the history
+ made labels.yaml optional
#patch
  • Loading branch information
Lucostus authored Jun 27, 2023
1 parent 7b66722 commit f11010f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions init.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,23 @@ func InitConfig() {
Cfg = &Config{}
V = viper.NewWithOptions(viper.KeyDelimiter("::"))
loadConfig("config")
loadConfig("labels")
if Cfg.Proxy.Provider == "configmap" {
loadConfig("labels")
}
}

// onConfigChange is a callback that gets triggered when a configuration file changes.
// It reloads the configuration from the files `config` and `labels`.
func onConfigChange(e fsnotify.Event) {
//Todo: change log level on reload
Cfg = &Config{}
configs := []string{"config", "labels"}
var configs []string
if Cfg.Proxy.Provider == "configmap" {
configs = []string{"config", "labels"}
} else {
configs = []string{"config"}
}

for _, name := range configs {
V.SetConfigName(name) // name of config file (without extension)
err := V.MergeInConfig()
Expand Down

0 comments on commit f11010f

Please sign in to comment.