-
Notifications
You must be signed in to change notification settings - Fork 11
Support GNUPGHOME environment variable #9
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
Support GNUPGHOME environment variable #9
Conversation
I'm also looking into writing a test for this use case. Currently I have this:
Which I find a bit ugly, since this asserts on matching an error string, instead of the compiled path. |
047f512
to
2a6d5be
Compare
Great idea to use |
home = os.Getenv("GNUPGHOME") | ||
} | ||
|
||
ringfile := path.Join(home, ".gnupg", "pubring.gpg") |
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.
If $GNUPGHOME
is set, ringfile
here would be $GNUPGHOME/.gnupg/pubring.gpg
. Is that the standard usage? Reading the gpg
man page, it looks like $GNUPGHOME
is equivalent to $HOME/.gnupg
, i.e. the top-level GnuPG directory:
--homedir dir
Set the name of the home directory to dir. If this option is not used, the home directory defaults to~/.gnupg
. It is only recognized when given on the command line. It also overrides any home directory stated through the environment variableGNUPGHOME
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.
You are right, I could have tested this. I don't use $GNUPGHOME on the machine I coded this :)
I rebased my branch from master and changed the path. Should be correct now.
For the test, it might make sense to extract the |
2a6d5be
to
e9995dc
Compare
Hi @ellotheth I just refactored the ringfile to a separate struct and added/changed tests for multiple use cases. Let me know what you think, when I merge this, it'll be added in this branch/PR. |
Alternate implementation for #9
Hi @dennisdegreef, Your branch looks stellar, but I'm not quite ready to start wrapping |
It looks good! 👍 I was just trying out a different solution, while making myself more familiar with Golang. |
Alternate implementation for ellotheth#9
Now that I've dirtied up |
bbceaa4
to
83f1304
Compare
No problem, pushed it |
I sometimes use the
GNUPGHOME
variable to point to a different set of rings.This pull request should enable the usage of the environment variable and perform the previous behaviour if it is not set.
Let me know what you think.