Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Commit58320e4

Browse files
authored
cli: Use map for config-ssh ux State write (#199)
Context:`cliSSHConfigured` is changing data structure from `bool` -> `map[string]bool`in order to capture which environments are configured for SSH.
1 parent1f16b2b commit58320e4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

‎internal/cmd/configssh.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func configSSH(configpath *string, remove *bool) func(cmd *cobra.Command, _ []st
135135
fmt.Printf("Your private ssh key was written to\"%s\"\n",privateKeyFilepath)
136136
}
137137

138-
writeSSHUXState(ctx,client,user.ID)
138+
writeSSHUXState(ctx,client,user.ID,envs)
139139
fmt.Printf("An auto-generated ssh config was written to\"%s\"\n",*configpath)
140140
fmt.Println("You should now be able to ssh into your environment")
141141
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) {
258258
returnstring(contents),nil
259259
}
260260

261-
funcwriteSSHUXState(ctx context.Context,client*coder.Client,userIDstring) {
261+
funcwriteSSHUXState(ctx context.Context,client*coder.Client,userIDstring,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:=rangeenvs {
266+
cliSSHConfigured[env.ID]=true
267+
}
262268
// Update UXState that coder config-ssh has been run by the currently
263269
// authenticated user
264-
err:=client.UpdateUXState(ctx,userID,map[string]interface{}{"cliSSHConfigured":true})
270+
err:=client.UpdateUXState(ctx,userID,map[string]interface{}{"cliSSHConfigured":cliSSHConfigured})
265271
iferr!=nil {
266272
clog.LogWarn("The Coder web client may not recognize that you've configured SSH.")
267273
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp