From d19e833d7f3aab93d733e472268fcc2638dd1f92 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 9 Jul 2024 17:58:55 +0530 Subject: [PATCH 1/2] Fix root command setup to respect home flag --- cmd/laconicd/cmd/root.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cmd/laconicd/cmd/root.go b/cmd/laconicd/cmd/root.go index 303ef8f9..679c18e7 100644 --- a/cmd/laconicd/cmd/root.go +++ b/cmd/laconicd/cmd/root.go @@ -68,7 +68,7 @@ func NewRootCmd() *cobra.Command { cmd.SetOut(cmd.OutOrStdout()) cmd.SetErr(cmd.ErrOrStderr()) - clientCtx = clientCtx.WithCmdContext(cmd.Context()) + clientCtx = clientCtx.WithCmdContext(cmd.Context()).WithViper(EnvPrefix) clientCtx, err := client.ReadPersistentCommandFlags(clientCtx, cmd.Flags()) if err != nil { return err @@ -96,10 +96,6 @@ func NewRootCmd() *cobra.Command { return err } - if err := client.SetCmdClientContextHandler(clientCtx, cmd); err != nil { - return err - } - // overwrite the minimum gas price from the app configuration srvCfg := serverconfig.DefaultConfig() srvCfg.MinGasPrices = "0photon" -- 2.45.2 From 8750ef06f04f757a549f6e791f2436ce97e2209b Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 9 Jul 2024 16:21:22 +0530 Subject: [PATCH 2/2] Avoid providing default home dir to depinject --- cmd/laconicd/cmd/root.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/laconicd/cmd/root.go b/cmd/laconicd/cmd/root.go index 679c18e7..638f554f 100644 --- a/cmd/laconicd/cmd/root.go +++ b/cmd/laconicd/cmd/root.go @@ -134,7 +134,9 @@ func ProvideClientContext( WithLegacyAmino(legacyAmino). WithInput(os.Stdin). WithAccountRetriever(types.AccountRetriever{}). - WithHomeDir(app.DefaultNodeHome). + // Workaround: Avoid providing DefaultNodeHome to depinject as it is given precedence over the one passed using --home flag in some CLI commands + // TODO: Implement proper fix + // WithHomeDir(app.DefaultNodeHome). WithViper(EnvPrefix) // env variable prefix // Read the config again to overwrite the default values with the values from the config file -- 2.45.2