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

Commit 70b569f

Browse files
authored
fix: credential secrets: use defaults as defined in the Acornfile (#2420)
Signed-off-by: Grant Linville <grant@acorn.io>
1 parent 002f6b5 commit 70b569f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

pkg/login/login.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,14 @@ func createSecret(ctx context.Context, c client.Client, app *apiv1.App, secretNa
106106
data := map[string][]byte{}
107107
promptOrder, _ := app.Status.AppSpec.Secrets[secretName].Params.GetData()["promptOrder"].([]string)
108108
for _, key := range promptOrder {
109-
if _, ok := app.Status.AppSpec.Secrets[secretName].Data[key]; ok {
110-
value, err := prompt.Password(key)
109+
if def, ok := app.Status.AppSpec.Secrets[secretName].Data[key]; ok {
110+
value, err := prompt.Password(fmt.Sprintf("%s (default: %s)", key, def))
111111
if err != nil {
112112
return err
113113
}
114+
if len(value) == 0 {
115+
value = []byte(def)
116+
}
114117
data[key] = value
115118
asked[key] = struct{}{}
116119
}
@@ -119,10 +122,14 @@ func createSecret(ctx context.Context, c client.Client, app *apiv1.App, secretNa
119122
if _, asked := asked[key]; asked {
120123
continue
121124
}
122-
value, err := prompt.Password(key)
125+
def := app.Status.AppSpec.Secrets[secretName].Data[key]
126+
value, err := prompt.Password(fmt.Sprintf("%s (default: %s)", key, def))
123127
if err != nil {
124128
return err
125129
}
130+
if len(value) == 0 {
131+
value = []byte(def)
132+
}
126133
data[key] = value
127134
}
128135

0 commit comments

Comments
 (0)