github.com/kubeshop/testkube@v1.17.23/cmd/kubectl-testkube/commands/oauth/disable.go (about) 1 package oauth 2 3 import ( 4 "github.com/spf13/cobra" 5 6 "github.com/kubeshop/testkube/cmd/kubectl-testkube/config" 7 "github.com/kubeshop/testkube/pkg/ui" 8 ) 9 10 // NewDisableOAuthCmd is oauth disable command 11 func NewDisableOAuthCmd() *cobra.Command { 12 cmd := &cobra.Command{ 13 Use: "oauth", 14 Short: "disable oauth authentication for direct api", 15 Run: func(cmd *cobra.Command, args []string) { 16 ui.NL() 17 ui.Print(ui.IconRocket + " Disabling OAuth authentication for direct api") 18 cfg, err := config.Load() 19 20 if err == nil { 21 cfg.DisableOauth() 22 err = config.Save(cfg) 23 } 24 if err != nil { 25 ui.PrintDisabled("OAuth", "failed") 26 ui.PrintConfigError(err) 27 } else { 28 ui.PrintDisabled("OAuth", "disabled") 29 } 30 ui.NL() 31 }, 32 } 33 34 return cmd 35 }