-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Bug]: --home
flag is not respected
#18868
Comments
Correct, AutoCLI needs some prefilled default data. |
Hey, I wanted to kindly ask what is the ETA on fixing this? We are waiting for this to do an upgrade. We could also help with a PR in case you have other priorities. cc @PoisonPhang |
I won't have time before at least end next week for finishing it. |
Hi @julienrbrt Does the |
Hi, first of all I would advise you to work being based off main, as it will complicate your life when opening a PR otherwise. To answer your question, in v0.50, all modules are using AutoCLI for queries but mostly not for txs. In main all modules have migrated to AutoCLI (queries + txs) unless the UX of a manually defined CLI was better. |
I think I found the issue, or at least one of them. I'll think about a fix, but I though I'd provide an update in the meantime. When initializing the root command with simd using app/root v2, the function clientCtx := client.Context{}.
WithCodec(appCodec).
WithInterfaceRegistry(interfaceRegistry).
WithLegacyAmino(legacyAmino).
WithInput(os.Stdin).
WithAccountRetriever(types.AccountRetriever{}).
WithHomeDir(simapp.DefaultNodeHome).
WithViper("") // In simapp, we don't use any prefix for env variables. This sets the default home directory then calls
|
IMO, calling |
Thanks for the sum-up, this is indeed most of the issue. The solution I was trying to implement is to have the commands created by autocli share the context of the root command, removing the instantiation need of the clientCtx. This was still leaving the issue of the keyring, that we require in autocli before building the commands. |
I'm making progress, but still hitting some issues. In In However, when executing txs, I'm still getting the |
Okay, the function cmd.Context().Value(ClientContextKey)
Technically, this returns |
@julienrbrt do you have this work on any public branch? In addition to the fixes I've made - I think this issue could be resolved. However, I'm struggling with unifying the AutoCLI context and the root command context. |
Tentative solution #18994 |
@julienrbrt while the changes I proposed in #18994 work fine on |
Hey, thanks for the quick PR, I'll review it tomorrow. Are you saying it does not work on v0.50?
Not yet, and right, and we are a bit holding off on it because the short-term plan is to remove completely |
Turns out this was an issue with how simapp was configured on our fork. Solution is working on v0.50.2 now.
I see, thanks. My solution may prove helpful in the meantime while a much larger refactor is conducted. Though, a few of my changes are genuine fixes. See the description of #18994 for more details. |
Hi folks, we noticed this issue isn't working on main still for some cases. For example:
Now both |
Is there an existing issue for this?
What happened?
When running
simd
,--home
flag is not fully respected. The application still creates theconfig
directory under the default home location which is~/.simapp
.My initial findings show that this line which reads the application flags is called after this line which is used for injecting the sdk's cli options.
Cosmos SDK Version
0.50.x,main
How to reproduce?
rm -rf ~/.simapp
./simd start --home ./other-location
ls ~/.simapp
The text was updated successfully, but these errors were encountered: