Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
fix: credential secrets: handle case where no default is set (#2423)
Browse files Browse the repository at this point in the history
Signed-off-by: Grant Linville <[email protected]>
  • Loading branch information
g-linville authored Jan 18, 2024
1 parent f2b89cf commit 2fdf218
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/login/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ func createSecret(ctx context.Context, c client.Client, app *apiv1.App, secretNa
promptOrder, _ := app.Status.AppSpec.Secrets[secretName].Params.GetData()["promptOrder"].([]string)
for _, key := range promptOrder {
if def, ok := app.Status.AppSpec.Secrets[secretName].Data[key]; ok {
value, err := prompt.Password(fmt.Sprintf("%s (default: %s)", key, def))
message := key
if def != "" {
message += fmt.Sprintf(" (default: %s)", def)
}
value, err := prompt.Password(message)
if err != nil {
return err
}
Expand All @@ -123,7 +127,11 @@ func createSecret(ctx context.Context, c client.Client, app *apiv1.App, secretNa
continue
}
def := app.Status.AppSpec.Secrets[secretName].Data[key]
value, err := prompt.Password(fmt.Sprintf("%s (default: %s)", key, def))
message := key
if def != "" {
message += fmt.Sprintf(" (default: %s)", def)
}
value, err := prompt.Password(message)
if err != nil {
return err
}
Expand Down

0 comments on commit 2fdf218

Please sign in to comment.