-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for ssh-agent #1
base: master
Are you sure you want to change the base?
Conversation
Hi, thanks for the PR. I'm open to the change, but using environment variables is a distinct change from the fact that everything else is configured through a JSON configuration file. We should be consistent in specifying agent information in the configuration file as well. |
Hi~ I re-adjusted the code logic to respect the user's configuration in json. When the user does not configure it, the environment variables are read by default and the actual effective values are printed in the log.
|
main.go
Outdated
@@ -137,6 +155,10 @@ func loadConfig(conf string) (tunns []tunnel, logger *log.Logger, closer func() | |||
if err := json.Unmarshal(c, &config); err != nil { | |||
logger.Fatalf("unable to decode config: %v", err) | |||
} | |||
if config.SshAgentSocket == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not comfortable adding environment variable support and unless we're going to do it for all the configuration parameters. Consistency is a property I find valuable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is the only point I'd like to discuss.
Consistency is indeed crucial, but the Unix socket file provided by ssh-agent typically resides in a temporary directory, which makes it challenging to hardcode in a json file. As part of usability, I would like to update the README.md to make it more informative.
Signed-off-by: yuguorui <[email protected]>
c1e9af1
to
d5dff8d
Compare
Signed-off-by: ruogui.ygr <[email protected]>
Add support for ssh-agent, which can simplify the use of encrypted private keys. As you can load encrypted private keys to ssh-agent to facilitate the sshtunnel.