diff --git a/CHANGELOG.md b/CHANGELOG.md index 8988ddb..cd981fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Fixed + +- SSH config is regenerated correctly when Workspaces are added or removed + ## 0.1.0 - 2025-04-01 ### Added diff --git a/src/main/kotlin/com/coder/toolbox/CoderRemoteEnvironment.kt b/src/main/kotlin/com/coder/toolbox/CoderRemoteEnvironment.kt index 62fe4bb..8319cdc 100644 --- a/src/main/kotlin/com/coder/toolbox/CoderRemoteEnvironment.kt +++ b/src/main/kotlin/com/coder/toolbox/CoderRemoteEnvironment.kt @@ -194,10 +194,9 @@ class CoderRemoteEnvironment( */ override fun equals(other: Any?): Boolean { if (other == null) return false - if (this === other) return true // Note the triple === + if (this === other) return true if (other !is CoderRemoteEnvironment) return false - if (id != other.id) return false - return true + return id == other.id } /** diff --git a/src/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt b/src/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt index fef85ff..4ce1bc7 100644 --- a/src/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt +++ b/src/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt @@ -113,12 +113,11 @@ class CoderRemoteProvider( return@launch } - // Reconfigure if a new environment is found. - // TODO@JB: Should we use the add/remove listeners instead? - val newEnvironments = resolvedEnvironments.subtract(lastEnvironments) - if (newEnvironments.isNotEmpty()) { - context.logger.info("Found new environment(s), reconfiguring CLI: $newEnvironments") - cli.configSsh(newEnvironments.map { it.name }.toSet()) + + // Reconfigure if environments changed. + if (lastEnvironments.size != resolvedEnvironments.size || lastEnvironments != resolvedEnvironments) { + context.logger.info("Workspaces have changed, reconfiguring CLI: $resolvedEnvironments") + cli.configSsh(resolvedEnvironments.map { it.name }.toSet()) } environments.update { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy