Closed leohhhn closed 10 months ago
the GNOHOME environment variable?
I am talking specifically on the -home
parameter, which stores the path to the data dir where the keypairs are stored. Not sure if it coincides with GNOHOME/GNOROOT directly.
I'm reading through gnokey
code, it seems that the default is empty, ie from this snippet:
var DefaultBaseOptions = BaseOptions{
Home: "",
Remote: "127.0.0.1:26657",
Quiet: false,
InsecurePasswordStdin: false,
Config: "",
}
The way gnokey infers its home parameter is very weird, and frankly I'm not sure how it works.
I'm reading through
gnokey
code, it seems that the default is empty, ie from this snippet:
So, it's a bit different.
The gnokey
binary doesn't actually use client.DefaultBaseOptions
(the variable you posted). Instead, refer to cmd/gnokey/main.go
: this one shows that the true base config used is the following:
baseCfg := client.BaseOptions{
Home: gnoenv.HomeDir(),
Remote: "127.0.0.1:26657",
}
Ie. the default value for -home
1 is gnoenv.HomeDir
.
This is gnovm/pkg/gnoenv/gnohome.go
. In summary: it's GNOHOME
, and if it is not set it falls back to ~/.config/gno
(on UNIX, on Windows it's AppData IIRC).
What we should recommend users, if they want to change their home directory permanently, is to add export GNOHOME=/path/to/gnohome
in their ~/.profile
. (In fact, I think we should remove the -home
flag altogether, as I don't think it's something a user wants to change with each execution, but I digress)
Cool, thanks. I'll close this issue in favor of documenting this more clearly.
Description
In case a user wants to have its
gnokey
home dir in a different place that the default one, it would be a good UX addition forgnokey
to be able to permenantly set the home dir instead of having to pass it in with every command.Currently, the
-home
parameter is not persisted between calls to thegnokey
binary.