Skip to content

Commit

Permalink
Pass auth sock id to other IDEs
Browse files Browse the repository at this point in the history
  • Loading branch information
bkneis committed Dec 17, 2024
1 parent c9fb98a commit 631f742
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
15 changes: 9 additions & 6 deletions cmd/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ func (cmd *UpCmd) Run(
ideConfig.Options,
cmd.GitUsername,
cmd.GitToken,
cmd.AuthSockID,
log,
)
case string(config.IDEJupyterDesktop):
Expand All @@ -345,6 +346,7 @@ func (cmd *UpCmd) Run(
ideConfig.Options,
cmd.GitUsername,
cmd.GitToken,
cmd.AuthSockID,
log)
case string(config.IDEMarimo):
return startMarimoInBrowser(
Expand All @@ -356,6 +358,7 @@ func (cmd *UpCmd) Run(
ideConfig.Options,
cmd.GitUsername,
cmd.GitToken,
cmd.AuthSockID,
log)
}
}
Expand Down Expand Up @@ -582,7 +585,7 @@ func startMarimoInBrowser(
client client2.BaseWorkspaceClient,
user string,
ideOptions map[string]config.OptionValue,
gitUsername, gitToken string,
gitUsername, gitToken, authSockID string,
logger log.Logger,
) error {
if forwardGpg {
Expand Down Expand Up @@ -629,7 +632,7 @@ func startMarimoInBrowser(
extraPorts,
gitUsername,
gitToken,
"",
authSockID,
logger,
)
}
Expand All @@ -641,7 +644,7 @@ func startJupyterNotebookInBrowser(
client client2.BaseWorkspaceClient,
user string,
ideOptions map[string]config.OptionValue,
gitUsername, gitToken string,
gitUsername, gitToken, authSockID string,
logger log.Logger,
) error {
if forwardGpg {
Expand Down Expand Up @@ -688,7 +691,7 @@ func startJupyterNotebookInBrowser(
extraPorts,
gitUsername,
gitToken,
"",
authSockID,
logger,
)
}
Expand All @@ -700,7 +703,7 @@ func startJupyterDesktop(
client client2.BaseWorkspaceClient,
user string,
ideOptions map[string]config.OptionValue,
gitUsername, gitToken string,
gitUsername, gitToken, authSockID string,
logger log.Logger,
) error {
if forwardGpg {
Expand Down Expand Up @@ -744,7 +747,7 @@ func startJupyterDesktop(
extraPorts,
gitUsername,
gitToken,
"",
authSockID,
logger,
)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/tunnel/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func NewContainerTunnel(client client.WorkspaceClient, proxy bool, log log.Logge
}
}

// ContainerTunnel is a struct that contains the workspace client to use, if proxy is
// ContainerTunnel manages the state of the tunnel to the container
type ContainerTunnel struct {
client client.WorkspaceClient
updateConfigInterval time.Duration
Expand Down Expand Up @@ -184,7 +184,7 @@ func (c *ContainerTunnel) updateConfig(ctx context.Context, sshClient *ssh.Clien
}

// runInContainer uses the connected SSH client to execute runInContainer on the remote
func (c *ContainerTunnel) runInContainer(ctx context.Context, sshClient *ssh.Client, runInContainer Handler, envVars map[string]string) error {
func (c *ContainerTunnel) runInContainer(ctx context.Context, sshClient *ssh.Client, handler Handler, envVars map[string]string) error {
// compress info
workspaceInfo, _, err := c.client.AgentInfo(provider.CLIOptions{Proxy: c.proxy})
if err != nil {
Expand Down Expand Up @@ -237,5 +237,5 @@ func (c *ContainerTunnel) runInContainer(ctx context.Context, sshClient *ssh.Cli
c.log.Debugf("Successfully connected to container")

// start handler
return runInContainer(cancelCtx, containerClient)
return handler(cancelCtx, containerClient)
}

0 comments on commit 631f742

Please sign in to comment.