Skip to content

Commit

Permalink
Use auth function for sourcing token in runner
Browse files Browse the repository at this point in the history
  • Loading branch information
MDrakos committed Oct 11, 2024
1 parent ec573a4 commit ca0e7ad
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions internal/runners/auth/auth.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package auth

import (
"os"

"github.com/ActiveState/cli/internal/constants"
"github.com/ActiveState/cli/internal/errs"
"github.com/ActiveState/cli/internal/keypairs"
"github.com/ActiveState/cli/internal/locale"
Expand Down Expand Up @@ -95,8 +92,8 @@ func (a *Auth) authenticate(params *AuthParams) error {
return auth.AuthenticateWithToken(params.Token, a.Auth)
}

if apiKey := os.Getenv(constants.APIKeyEnvVarName); apiKey != "" {
err := auth.AuthenticateWithToken(apiKey, a.Auth)
if token := a.Auth.AvailableAPIToken(); token != "" {
err := auth.AuthenticateWithToken(token, a.Auth)
if err != nil {
return errs.Wrap(err, "Failed to authenticate with API key")
}
Expand Down

0 comments on commit ca0e7ad

Please sign in to comment.