Skip to content

Commit

Permalink
cluster delete command was not using the correct viper instance...
Browse files Browse the repository at this point in the history
  • Loading branch information
dprunier committed Jul 15, 2024
1 parent 5f74fc0 commit 6f3de1c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/cluster/clusterDelete.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ var (

func initClusterDeleteConfig() error {
// Viper for pre-processed config options
ppViper.SetEnvPrefix("K3D")
ppViper.AutomaticEnv()
ppViper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
clusterDeletePpViper.SetEnvPrefix("K3D")
clusterDeletePpViper.AutomaticEnv()
clusterDeletePpViper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))

if l.Log().GetLevel() >= logrus.DebugLevel {
c, _ := yaml.Marshal(ppViper.AllSettings())
l.Log().Debugf("Additional CLI Configuration:\n%s", c)
}

return cliconfig.InitViperWithConfigFile(cfgViper, ppViper.GetString("config"))
return cliconfig.InitViperWithConfigFile(cfgViper, clusterDeletePpViper.GetString("config"))
}

// NewCmdClusterDelete returns a new cobra command
Expand Down Expand Up @@ -119,7 +119,7 @@ func NewCmdClusterDelete() *cobra.Command {
***************/

cmd.Flags().StringP("config", "c", "", "Path of a config file to use")
_ = ppViper.BindPFlag("config", cmd.Flags().Lookup("config"))
_ = clusterDeletePpViper.BindPFlag("config", cmd.Flags().Lookup("config"))
if err := cmd.MarkFlagFilename("config", "yaml", "yml"); err != nil {
l.Log().Fatalln("Failed to mark flag 'config' as filename flag")
}
Expand Down

0 comments on commit 6f3de1c

Please sign in to comment.