Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jakedoublev committed May 3, 2024
1 parent e06b720 commit fe378e5
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,16 @@ func readBytesFromFile(filePath string) []byte {
// instantiates a new handler with authentication via client credentials
func NewHandler(cmd *cobra.Command) handlers.Handler {
platformEndpoint := cmd.Flag("host").Value.String()
var (
creds handlers.ClientCreds
err error
)

// load client credentials from file, JSON, or OS keyring
creds, err = handlers.GetClientCreds(clientCredsFile, []byte(clientCredsJSON))
creds, err := handlers.GetClientCreds(clientCredsFile, []byte(clientCredsJSON))
if err != nil {
cli.ExitWithError("Failed to get client credentials", err)
}
h, err := handlers.New(platformEndpoint, creds.ClientID, creds.ClientSecret)
if err != nil {
if errors.Is(err, handlers.ErrUnauthenticated) {
cli.ExitWithError(fmt.Sprintf("Not logged in. Please authenticate via CLI auth flow(s) before using command (%s)", cmd.Use), err)
cli.ExitWithError(fmt.Sprintf("Not logged in. Please authenticate via CLI auth flow(s) before using command (%s %s)", cmd.Parent().Use, cmd.Use), err)
}
cli.ExitWithError("Failed to connect to server", err)
}
Expand Down

0 comments on commit fe378e5

Please sign in to comment.