Skip to content

Commit aa6dbd9

Browse files
committed
fix: save API key to profile
1 parent c642cee commit aa6dbd9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/login/client_login.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import (
66
"fmt"
77
"io"
88
"io/ioutil"
9-
"log"
109
"net/http"
1110
"net/url"
1211
"os"
1312

13+
log "github.com/sirupsen/logrus"
14+
1415
"github.com/briandowns/spinner"
1516

1617
"github.com/hookdeck/hookdeck-cli/pkg/ansi"
@@ -36,6 +37,11 @@ func Login(config *config.Config, input io.Reader) error {
3637
var s *spinner.Spinner
3738

3839
if config.Profile.APIKey != "" {
40+
log.WithFields(log.Fields{
41+
"prefix": "login.Login",
42+
"APIKey": config.Profile.APIKey,
43+
}).Debug("Logging in with API key")
44+
3945
s = ansi.StartNewSpinner("Verifying credentials...", os.Stdout)
4046
response, err := ValidateKey(config.APIBaseURL, config.Profile.APIKey, config.Profile.TeamID)
4147
if err != nil {
@@ -45,6 +51,8 @@ func Login(config *config.Config, input io.Reader) error {
4551
message := SuccessMessage(response.UserName, response.UserEmail, response.OrganizationName, response.TeamName, response.TeamMode == "console")
4652
ansi.StopSpinner(s, message, os.Stdout)
4753

54+
config.Profile.SaveProfile(config.LocalConfigFile != "")
55+
4856
return nil
4957
}
5058

0 commit comments

Comments
 (0)