Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
theFong committed Nov 15, 2024
1 parent 6a1487c commit 79457bc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
3 changes: 0 additions & 3 deletions pkg/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ type LoginAuth struct {
Auth
}

// assert that LoginAuth implements store.Auth
// var _ store.Auth = (*LoginAuth)(nil)

func NewLoginAuth(authStore AuthStore, oauth OAuth) *LoginAuth {
return &LoginAuth{
Auth: *NewAuth(authStore, oauth),
Expand Down
8 changes: 6 additions & 2 deletions pkg/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ func NewBrevCommand() *cobra.Command { //nolint:funlen,gocognit,gocyclo // defin
OauthTokenEndpoint: "https://brevdev.us.auth0.com/oauth/token",
}

email := auth.GetEmailFromToken(tokens.AccessToken)
shouldPromptEmail := true
var email string
shouldPromptEmail := false
if tokens != nil && tokens.AccessToken != "" {
email = auth.GetEmailFromToken(tokens.AccessToken)
shouldPromptEmail = true
}
if emailFlag != "" {
email = emailFlag
shouldPromptEmail = false
Expand Down
9 changes: 0 additions & 9 deletions pkg/store/authtoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,6 @@ func (f FileStore) GetAuthTokens() (*entity.AuthTokens, error) {
return &token, nil
}

// func (f FileStore) getBrevCredentialsFile() (*string, error) {
// home, err := f.UserHomeDir()
// if err != nil {
// return nil, breverrors.WrapAndTrace(err)
// }
// brevCredentialsFile := path.Join(home, brevDirectory, brevCredentialsFile)
// return &brevCredentialsFile, nil
// }

func (f FileStore) GetCurrentWorkspaceServiceToken() (string, error) {
saTokenFilePath := getServiceTokenFilePath()
// safely check if file exists
Expand Down
3 changes: 2 additions & 1 deletion pkg/store/organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package store

import (
"fmt"
"strings"

"github.com/brevdev/brev-cli/pkg/entity"
breverrors "github.com/brevdev/brev-cli/pkg/errors"
Expand Down Expand Up @@ -31,7 +32,7 @@ func (f FileStore) ClearDefaultOrganization() error {
}
path := files.GetActiveOrgsPath(home)
err = files.DeleteFile(f.fs, path)
if err != nil {
if err != nil && !strings.Contains(err.Error(), "no such file or directory") {
return breverrors.WrapAndTrace(err)
}
return nil
Expand Down

0 comments on commit 79457bc

Please sign in to comment.