Skip to content

Commit ca0e7ad

Browse files
committed
Use auth function for sourcing token in runner
1 parent ec573a4 commit ca0e7ad

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

internal/runners/auth/auth.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package auth
22

33
import (
4-
"os"
5-
6-
"github.com/ActiveState/cli/internal/constants"
74
"github.com/ActiveState/cli/internal/errs"
85
"github.com/ActiveState/cli/internal/keypairs"
96
"github.com/ActiveState/cli/internal/locale"
@@ -95,8 +92,8 @@ func (a *Auth) authenticate(params *AuthParams) error {
9592
return auth.AuthenticateWithToken(params.Token, a.Auth)
9693
}
9794

98-
if apiKey := os.Getenv(constants.APIKeyEnvVarName); apiKey != "" {
99-
err := auth.AuthenticateWithToken(apiKey, a.Auth)
95+
if token := a.Auth.AvailableAPIToken(); token != "" {
96+
err := auth.AuthenticateWithToken(token, a.Auth)
10097
if err != nil {
10198
return errs.Wrap(err, "Failed to authenticate with API key")
10299
}

0 commit comments

Comments
 (0)