Skip to content
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

Request: Be able to permanently set -home parameter for gnokey #1504

Closed
leohhhn opened this issue Jan 8, 2024 · 4 comments
Closed

Request: Be able to permanently set -home parameter for gnokey #1504

leohhhn opened this issue Jan 8, 2024 · 4 comments

Comments

@leohhhn
Copy link
Contributor

leohhhn commented Jan 8, 2024

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 for gnokey 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 the gnokey binary.

@thehowl
Copy link
Member

thehowl commented Jan 8, 2024

the GNOHOME environment variable?

@leohhhn
Copy link
Contributor Author

leohhhn commented Jan 8, 2024

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.

@thehowl
Copy link
Member

thehowl commented Jan 8, 2024

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 -home1 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)

@leohhhn
Copy link
Contributor Author

leohhhn commented Jan 10, 2024

Cool, thanks. I'll close this issue in favor of documenting this more clearly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants