Skip to content

Commit

Permalink
fix: config miss (grafana#22)
Browse files Browse the repository at this point in the history
Due to some quirks of cobra, the new config format didn't actually work.
This fixes that.

Furthermore mutes the warnings about the deprecated config
Fixes grafana#14
  • Loading branch information
sh0rez authored Aug 12, 2019
1 parent f53c2b5 commit 32bc8a4
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions cmd/tk/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,6 @@ func setupConfiguration(baseDir string) *v1alpha1.Config {
}
viper.AddConfigPath(pwd)

// handle deprecated ksonnet spec
for old, new := range deprecated {
viper.RegisterAlias(new, old)
}

// read it
if err := viper.ReadInConfig(); err != nil {
// just run fine without config. Provider features won't work (apply, show, diff)
Expand All @@ -132,7 +127,16 @@ func setupConfiguration(baseDir string) *v1alpha1.Config {

log.Fatalln(err)
}
checkDeprecated()

// handle deprecated ksonnet spec
for old, new := range deprecated {
if viper.IsSet(old) && !viper.IsSet(new) {
viper.Set(new, viper.Get(old))
}
}

// disabled for now
// checkDeprecated()

var config v1alpha1.Config
if err := viper.Unmarshal(&config); err != nil {
Expand Down

0 comments on commit 32bc8a4

Please sign in to comment.