File tree 2 files changed +14
-3
lines changed
2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,10 @@ func workspaceAgent() *cobra.Command {
120
120
if err != nil {
121
121
return xerrors .Errorf ("writing agent session token to config: %w" , err )
122
122
}
123
+ err = cfg .URL ().Write (client .URL .String ())
124
+ if err != nil {
125
+ return xerrors .Errorf ("writing agent url to config: %w" , err )
126
+ }
123
127
124
128
closer := agent .New (client .ListenWorkspaceAgent , logger )
125
129
<- cmd .Context ().Done ()
Original file line number Diff line number Diff line change 1
1
package cli
2
2
3
3
import (
4
+ "net/url"
4
5
"os"
5
6
"os/exec"
6
7
8
+ "github.com/coder/coder/codersdk"
7
9
"github.com/spf13/cobra"
8
10
"golang.org/x/xerrors"
9
11
)
@@ -14,15 +16,20 @@ func gitssh() *cobra.Command {
14
16
Hidden : true ,
15
17
Short : `Wraps the "ssh" command and uses the coder gitssh key for authentication` ,
16
18
RunE : func (cmd * cobra.Command , args []string ) error {
17
- client , err := createClient (cmd )
19
+ cfg := createConfig (cmd )
20
+ rawURL , err := cfg .URL ().Read ()
18
21
if err != nil {
19
- return xerrors .Errorf ("create codersdk client: %w" , err )
22
+ return xerrors .Errorf ("read agent url from config: %w" , err )
23
+ }
24
+ parsedURL , err := url .Parse (rawURL )
25
+ if err != nil {
26
+ return xerrors .Errorf ("parse agent url from config: %w" , err )
20
27
}
21
- cfg := createConfig (cmd )
22
28
session , err := cfg .AgentSession ().Read ()
23
29
if err != nil {
24
30
return xerrors .Errorf ("read agent session from config: %w" , err )
25
31
}
32
+ client := codersdk .New (parsedURL )
26
33
client .SessionToken = session
27
34
28
35
key , err := client .AgentGitSSHKey (cmd .Context ())
You can’t perform that action at this time.
0 commit comments