@@ -135,7 +135,7 @@ func configSSH(configpath *string, remove *bool) func(cmd *cobra.Command, _ []st
135
135
fmt .Printf ("Your private ssh key was written to \" %s\" \n " , privateKeyFilepath )
136
136
}
137
137
138
- writeSSHUXState (ctx , client , user .ID )
138
+ writeSSHUXState (ctx , client , user .ID , envs )
139
139
fmt .Printf ("An auto-generated ssh config was written to \" %s\" \n " , * configpath )
140
140
fmt .Println ("You should now be able to ssh into your environment" )
141
141
fmt .Printf ("For example, try running\n \n \t $ ssh coder.%s\n \n " , envs [0 ].Name )
@@ -258,10 +258,16 @@ func readStr(filename string) (string, error) {
258
258
return string (contents ), nil
259
259
}
260
260
261
- func writeSSHUXState (ctx context.Context , client * coder.Client , userID string ) {
261
+ func writeSSHUXState (ctx context.Context , client * coder.Client , userID string , envs []coder.Environment ) {
262
+ // Create a map of env.ID -> true to indicate to the web client that all
263
+ // current environments have SSH configured
264
+ cliSSHConfigured := make (map [string ]bool )
265
+ for _ , env := range envs {
266
+ cliSSHConfigured [env .ID ] = true
267
+ }
262
268
// Update UXState that coder config-ssh has been run by the currently
263
269
// authenticated user
264
- err := client .UpdateUXState (ctx , userID , map [string ]interface {}{"cliSSHConfigured" : true })
270
+ err := client .UpdateUXState (ctx , userID , map [string ]interface {}{"cliSSHConfigured" : cliSSHConfigured })
265
271
if err != nil {
266
272
clog .LogWarn ("The Coder web client may not recognize that you've configured SSH." )
267
273
}
0 commit comments