Skip to content

Commit 4268bbf

Browse files
committed
resolve asher's comments
1 parent 22631ab commit 4268bbf

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/main/kotlin/com/coder/gateway/cli/CoderCLIManager.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ class CoderCLIManager(
304304
.plus("\n")
305305
.plus(
306306
"""
307-
Host ${getHostName(deploymentURL, it.first, currentUser, it.second)}--bg
307+
Host ${getBackgroundHostName(deploymentURL, it.first, currentUser, it.second)}
308308
ProxyCommand ${backgroundProxyArgs.joinToString(" ")} ${getWorkspaceParts(it.first, it.second)}
309309
ConnectTimeout 0
310310
StrictHostKeyChecking no
@@ -493,12 +493,23 @@ class CoderCLIManager(
493493
currentUser: User,
494494
agent: WorkspaceAgent,
495495
): String =
496+
// For a user's own workspace, we use the old syntax without a username for backwards compatibility,
497+
// since the user might have recent connections that still use the old syntax.
496498
if (currentUser.username == workspace.ownerName) {
497499
"coder-jetbrains--${workspace.name}.${agent.name}--${url.safeHost()}"
498500
} else {
499501
"coder-jetbrains--${workspace.ownerName}--${workspace.name}.${agent.name}--${url.safeHost()}"
500502
}
501503

504+
fun getBackgroundHostName(
505+
url: URL,
506+
workspace: Workspace,
507+
currentUser: User,
508+
agent: WorkspaceAgent,
509+
): String {
510+
return getHostName(url, workspace, currentUser, agent) + "--bg"
511+
}
512+
502513

503514
/**
504515
* This function returns the identifier for the workspace to pass to the

src/main/kotlin/com/coder/gateway/views/steps/CoderWorkspaceProjectIDEStepView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class CoderWorkspaceProjectIDEStepView(
214214
} else {
215215
IDECellRenderer(CoderGatewayBundle.message("gateway.connector.view.coder.connect-ssh"))
216216
}
217-
val executor = createRemoteExecutor(CoderCLIManager.getHostName(data.client.url, data.workspace, data.client.me, data.agent) + "--bg")
217+
val executor = createRemoteExecutor(CoderCLIManager.getBackgroundHostName(data.client.url, data.workspace, data.client.me, data.agent))
218218

219219
if (ComponentValidator.getInstance(tfProject).isEmpty) {
220220
logger.info("Installing remote path validator...")

0 commit comments

Comments
 (0)