refactor: use descriptive verbs for SSH config construction - #420
Open
th3james wants to merge 4 commits into
Open
refactor: use descriptive verbs for SSH config construction#420th3james wants to merge 4 commits into
th3james wants to merge 4 commits into
Conversation
th3james
marked this pull request as ready for review
August 20, 2026 15:00
th3james
force-pushed
the
target-env-refactor
branch
from
August 20, 2026 15:04
07140a7 to
f2a951a
Compare
th3james
commented
Aug 20, 2026
| err := env.SetTargetEnv("localhost") | ||
|
|
||
| require.NoError(t, err) | ||
| assert.Equal(t, "ssh://localhost", os.Getenv(env.TargetVariable)) |
Contributor
Author
There was a problem hiding this comment.
This codifies the existing behaviour, but does call into question whether or not this is desirable
Contributor
There was a problem hiding this comment.
What's undesirable? The prepending of ssh://? If yes I've got no strong opinions but an argument in favour of leaving it is you want to write something like:
# compose.yaml
x-topo:
deployment_success_message: "Check out your new deployed application on the target with `ssh ${TOPO_TARGET} 'cat /my/cool/thing'`"This wouldn't work anymore if we removed the prepending since Topo happily accepts things like --target localhost:2222, an invalid ssh destination.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
I noticed that
ssh.NewConfighas a stateful side effect (exec'ingssh) and discarded its errors. Because stateful calls are so critical for performance and reliability, I prefer it when function names make it clear that they are stateful, which, IMHONewConfigdoes not. I recognise this may go slightly against the conventions for the use ofNewfor constructors in this repo, so happy to debate this.ssh.NewConfig->ssh.LoadConfigssh.NewConfigFromBytes->ssh.ParseConfigResolveHostNamefunction, and then uses itssh.LoadConfigreturn an error, forcing callers to handle itChecklist