Skip to content

Commit

Permalink
fix panics (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
enrichman authored Feb 23, 2024
1 parent 2cc3438 commit 5d18482
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions cmd/kubectl_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ func cacheCredential(ctx *cli.Context, cred *config.ExecCredential, id string) e
return err
}

if sc.KubeCredentials[id] == nil {
sc.KubeCredentials = make(map[string]*config.ExecCredential)
}
sc.KubeCredentials[id] = cred
cf.Servers[server] = sc
return cf.Write()
Expand Down
8 changes: 6 additions & 2 deletions cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ func serverCurrent(ctx *cli.Context) error {
}

serverName := cf.CurrentServer
URL := cf.Servers[serverName].URL
fmt.Printf("Name: %s URL: %s\n", serverName, URL)
currentServer, found := cf.Servers[serverName]
if !found {
return errors.New("Current server not set")
}

fmt.Printf("Name: %s URL: %s\n", serverName, currentServer.URL)
return nil
}

Expand Down

0 comments on commit 5d18482

Please sign in to comment.