@@ -65,6 +65,7 @@ func secretIsOk(app *apiv1.App, secretName string) (string, bool) {
6565}
6666
6767func printInstructions (app * apiv1.App , secretName string ) error {
68+ secretDisplayName := app .Name + "." + secretName
6869 instructions := app .Status .AppStatus .Secrets [secretName ].LoginInstructions
6970 if instructions == "" {
7071 return nil
@@ -80,6 +81,7 @@ func printInstructions(app *apiv1.App, secretName string) error {
8081 return err
8182 }
8283
84+ fmt .Printf ("Please follow the instructions below to login to [%s]:\n " , secretDisplayName )
8385 fmt .Print (msg )
8486 fmt .Println ()
8587 return nil
@@ -109,22 +111,26 @@ func createSecret(ctx context.Context, c client.Client, app *apiv1.App, secretNa
109111
110112 asked := map [string ]struct {}{}
111113 data := map [string ][]byte {}
112- promptOrder , _ := app .Status .AppSpec .Secrets [secretName ].Params .GetData ()["promptOrder" ].([]string )
113- for _ , key := range promptOrder {
114- if def , ok := app .Status .AppSpec .Secrets [secretName ].Data [key ]; ok {
115- message := key
116- if def != "" {
117- message += fmt .Sprintf (" (default: %s)" , def )
118- }
119- value , err := prompt .Password (message )
120- if err != nil {
121- return nil , err
122- }
123- if len (value ) == 0 {
124- value = []byte (def )
114+ paramsData := app .Status .AppSpec .Secrets [secretName ].Params .GetData ()
115+ if promptOrder , exists := paramsData ["promptOrder" ].([]interface {}); exists {
116+ for _ , k := range promptOrder {
117+ if key , ok := k .(string ); ok {
118+ if def , ok := app .Status .AppSpec .Secrets [secretName ].Data [key ]; ok {
119+ message := key
120+ if def != "" {
121+ message += fmt .Sprintf (" (default: %s)" , def )
122+ }
123+ value , err := prompt .Password (message )
124+ if err != nil {
125+ return nil , err
126+ }
127+ if len (value ) == 0 {
128+ value = []byte (def )
129+ }
130+ data [key ] = value
131+ asked [key ] = struct {}{}
132+ }
125133 }
126- data [key ] = value
127- asked [key ] = struct {}{}
128134 }
129135 }
130136 for _ , key := range typed .SortedKeys (app .Status .AppSpec .Secrets [secretName ].Data ) {
@@ -186,7 +192,8 @@ func loginSecret(ctx context.Context, c client.Client, app *apiv1.App, secretNam
186192
187193 if len (secretChoiceName ) > 0 {
188194 def := "Enter a new credential"
189- choice , err := prompt .Choice ("Choose an existing credential or enter a new one" , append (displayText , def ), def )
195+ choice , err := prompt .Choice (fmt .Sprintf ("Choose an existing credential or enter a new one for [%s]" ,
196+ secretDisplayName ), append (displayText , def ), def )
190197 if err != nil {
191198 return nil , err
192199 }
0 commit comments