Skip to content

Commit

Permalink
Remove need for GitHub OAuth during init
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSGK committed Jul 11, 2024
1 parent 672762a commit eb6ded6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cmd/lekko/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ func initCmd() *cobra.Command {
if err := secrets.WithWriteSecrets(func(ws secrets.WriteSecrets) error {
auth := oauth.NewOAuth(lekko.NewBFFClient(ws))
fmt.Println("Logging in to Lekko...")
if err := auth.Login(ctx, ws); err != nil {
if err := auth.LoginLekko(ctx, ws); err != nil {
return errors.Wrap(err, "login")
}
fmt.Printf("\n")
fmt.Printf("%s Successfully logged in as %s!\n\n", successCheck, logging.Bold(ws.GetLekkoUsername()))

bff := lekko.NewBFFClient(ws)

Expand Down
4 changes: 2 additions & 2 deletions pkg/oauth/oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func NewOAuth(bff bffv1beta1connect.BFFServiceClient) *OAuth {
// we will reinitiate oauath with that provider.
func (a *OAuth) Login(ctx context.Context, ws secrets.WriteSecrets) error {
defer a.Status(ctx, true, ws)
if err := a.loginLekko(ctx, ws); err != nil {
if err := a.LoginLekko(ctx, ws); err != nil {
return errors.Wrap(err, "login lekko")
}
if err := a.loginGithub(ctx, ws); err != nil {
Expand Down Expand Up @@ -284,7 +284,7 @@ func (a *OAuth) authStatus(ctx context.Context, skipAuthCheck bool, rs secrets.R
return
}

func (a *OAuth) loginLekko(ctx context.Context, ws secrets.WriteSecrets) error {
func (a *OAuth) LoginLekko(ctx context.Context, ws secrets.WriteSecrets) error {
if ws.HasLekkoToken() {
_, err := a.checkLekkoAuth(ctx)
if err == nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/repo/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func PrepareGithubRepo() (string, error) {
fmt.Println("failed to clone via ssh, trying via https")
fmt.Println(string(cloneOut))
fmt.Println(string(cloneOut2))
return "", errors.Wrapf(err2, "git cloning %s to %s with both https and ssh, your git setup may be unreachable, or you haven't created a Lekko account and linked to github Help @ https://docs.lekko.com", githubRepoURL, repoPath)
return "", errors.Wrapf(err2, "git cloning %s to %s with both https and ssh, your git setup may be unreachable, or you haven't created a Lekko account and linked to GitHub. Help @ https://docs.lekko.com", githubRepoURL, repoPath)
}
}
} else {
Expand Down

0 comments on commit eb6ded6

Please sign in to comment.