-
-
Notifications
You must be signed in to change notification settings - Fork 495
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
specify ssh dir #2981
base: master
Are you sure you want to change the base?
specify ssh dir #2981
Conversation
ad7ac91
to
67c27fe
Compare
@dominikschulz i realise this doesn't exactly implement the features described in #2933, but would this be a step in the right direction? |
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.
While it's not a flag, I think a env variable for that is actually more sensible.
A test would be nice too.
00a1b97
to
90ca354
Compare
90ca354
to
799289e
Compare
Signed-off-by: Joel Lau <[email protected]>
Signed-off-by: Joel Lau <[email protected]>
799289e
to
bcc3b44
Compare
@AnomalRoil are there any other changes required for this PR? |
if its not too much trouble, can i get this PR accepted for hacktoberfest by merging this pr or marking it with the |
internal/backend/crypto/age/ssh.go
Outdated
func getSSHDir() (string, error) { | ||
preferredPath := os.Getenv("GOPASS_SSH_DIR") | ||
sshDir := filepath.Join(preferredPath, ".ssh") | ||
if fsutil.IsDir(sshDir) { |
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 think we should also check if preferredPath
is not empty here. Otherwise we might end up with .ssh
(i.e. .ssh in the current pwd) w/o users asking for it.
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.
thanks @dominikschulz , i've added the check
2f14de5
to
7bd36f9
Compare
internal/backend/crypto/age/ssh.go
Outdated
func getSSHDir() (string, error) { | ||
preferredPath := os.Getenv("GOPASS_SSH_DIR") | ||
sshDir := filepath.Join(preferredPath, ".ssh") | ||
if fsutil.IsDir(sshDir) && sshDir != "" { |
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.
This should actually check if prefrerredPath is empty. Otherwise we might still pick up a .ssh dir does exist in the current pwd.
Signed-off-by: Joel Lau <[email protected]>
7bd36f9
to
142576f
Compare
func getSSHDir() (string, error) { | ||
preferredPath := os.Getenv("GOPASS_SSH_DIR") | ||
sshDir := filepath.Join(preferredPath, ".ssh") | ||
if fsutil.IsDir(sshDir) && preferredPath != "" { |
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.
Could you swap both conditions?
os.Getenv
is most likely to return an empty string for most users in most of the case, so let's not run IsDir
if we don't need to.
override default ~/.ssh/ directory for ssh paths