github.com/kubeshop/testkube@v1.17.23/cmd/kubectl-testkube/commands/oauth/status.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  // NewStatusOAuthCmd is oauth status command
    11  func NewStatusOAuthCmd() *cobra.Command {
    12  	cmd := &cobra.Command{
    13  		Use:   "oauth",
    14  		Short: "Get oauth status",
    15  		Run: func(cmd *cobra.Command, args []string) {
    16  			ui.NL()
    17  			ui.Print(ui.IconRocket + "  Getting OAuth status")
    18  
    19  			cfg, err := config.Load()
    20  			ui.ExitOnError("   Loading config file failed", err)
    21  			if cfg.OAuth2Data.Enabled {
    22  				ui.PrintEnabled("OAuth", "enabled")
    23  			} else {
    24  				ui.PrintDisabled("OAuth", "disabled")
    25  			}
    26  			ui.NL()
    27  		},
    28  	}
    29  
    30  	return cmd
    31  }