Skip to content

Commit

Permalink
fix: no-login option for enterprise still connecting to api
Browse files Browse the repository at this point in the history
  • Loading branch information
exu committed Jul 5, 2024
1 parent 7da22fd commit a1c366e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cmd/kubectl-testkube/commands/common/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,14 @@ func PopulateCloudConfig(cfg config.Data, apiKey string, opts *HelmOptions) conf
cfg.CloudContext.UiUri = opts.Master.URIs.Ui
cfg.CloudContext.AgentUri = opts.Master.URIs.Agent

var err error
cfg, err = PopulateOrgAndEnvNames(cfg, opts.Master.OrgId, opts.Master.EnvId, opts.Master.URIs.Api)
if err != nil {
ui.Failf("Error populating org and env names: %s", err)
if cfg.CloudContext.ApiKey != "" {
var err error
cfg, err = PopulateOrgAndEnvNames(cfg, opts.Master.OrgId, opts.Master.EnvId, opts.Master.URIs.Api)
if err != nil {
ui.Failf("Error populating org and env names: %s", err)
}
} else {
ui.Warn("No API key provided, you need to login to Testkube Cloud")
}

return cfg
Expand Down

0 comments on commit a1c366e

Please sign in to comment.