Skip to content

Commit

Permalink
Merge pull request #106 from jetstack/empty-config-crash
Browse files Browse the repository at this point in the history
[VC-24828] Fixed initialization of the config object
  • Loading branch information
wzurek authored Jul 11, 2023
2 parents cc1d87c + dfc7451 commit f9b6349
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/command/auth/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,17 @@ func Login(run types.RunFunc) *cobra.Command {

fmt.Println("Login succeeded")

cnf := &config.Config{}
var cnf *config.Config

// if the user already has an organization selected, we don't need to do anything
cnf, ok := config.FromContext(ctx)
if ok && cnf.Organization != "" {
return nil
}
// initiate empty config
if !ok {
cnf = &config.Config{}
}

http := client.New(ctx, apiURL)
organizations, err := organization.List(ctx, http)
Expand Down

0 comments on commit f9b6349

Please sign in to comment.