diff --git a/cmd/zrok/configUnset.go b/cmd/zrok/configUnset.go index a7cb6930..8060b3bd 100644 --- a/cmd/zrok/configUnset.go +++ b/cmd/zrok/configUnset.go @@ -3,7 +3,6 @@ package main import ( "fmt" "github.com/openziti/zrok/environment" - "github.com/openziti/zrok/environment/env_core" "github.com/openziti/zrok/tui" "github.com/spf13/cobra" "os" @@ -36,18 +35,25 @@ func (cmd *configUnsetCommand) run(_ *cobra.Command, args []string) { panic(err) } - switch configName { - case "apiEndpoint": - if err := env.SetConfig(&env_core.Config{}); err != nil { + if env.Config() != nil { + cfg := env.Config() + switch configName { + case "apiEndpoint": + cfg.ApiEndpoint = "" + if env.IsEnabled() { + fmt.Printf("\n[%v]: because you have a %v-d environment, you won't see your config change until you run %v first!\n\n", tui.WarningLabel, tui.Code.Render("zrok enable"), tui.Code.Render("zrok disable")) + } + + case "defaultFrontend": + cfg.DefaultFrontend = "" + + default: + fmt.Printf("unknown config name '%v'\n", configName) + os.Exit(1) + } + if err := env.SetConfig(cfg); err != nil { tui.Error("unable to save config", err) } fmt.Println("zrok configuration updated") - if env.IsEnabled() { - fmt.Printf("\n[%v]: because you have a %v-d environment, you won't see your config change until you run %v first!\n\n", tui.WarningLabel, tui.Code.Render("zrok enable"), tui.Code.Render("zrok disable")) - } - - default: - fmt.Printf("unknown config name '%v'\n", configName) - os.Exit(1) } }