From cb7b4a02792429811da9d5ed52e4de0345641bda Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 30 Aug 2024 00:06:25 +0200 Subject: [PATCH] fix(cmd): add missing --config handling (backport #4323) (#4325) * fix(cmd): add missing --config handling (#4323) * fix(cmd): add missing `--config` handling * cl * cl++ (cherry picked from commit 16a40f0a91b31cca31b42cd6b1d5f7b324b061c4) # Conflicts: # ignite/cmd/chain_debug.go * updates * cl --------- Co-authored-by: Julien Robert --- changelog.md | 4 ++++ ignite/cmd/chain_build.go | 6 ++++++ ignite/cmd/chain_debug.go | 6 ++---- ignite/cmd/chain_faucet.go | 5 +++++ ignite/cmd/chain_init.go | 6 ++++++ 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index 375fa2de86..293134554c 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,10 @@ - [#4292](https://github.com/ignite/cli/pull/4292) Bump Cosmos SDK to `v0.50.9` - [#4309](https://github.com/ignite/cli/pull/4309) Fix chain id for chain simulations +### Fixes + +- [#4323](https://github.com/ignite/cli/pull/4323) Add missing `--config` handling in the `chain` commands + ## [`v28.5.1`](https://github.com/ignite/cli/releases/tag/v28.5.1) ### Features diff --git a/ignite/cmd/chain_build.go b/ignite/cmd/chain_build.go index 6b89b0a6ca..e5bca7fdd2 100644 --- a/ignite/cmd/chain_build.go +++ b/ignite/cmd/chain_build.go @@ -123,6 +123,12 @@ func chainBuildHandler(cmd *cobra.Command, _ []string) error { chainOption = append(chainOption, chain.CheckDependencies()) } + // check if custom config is defined + config, _ := cmd.Flags().GetString(flagConfig) + if config != "" { + chainOption = append(chainOption, chain.ConfigFile(config)) + } + c, err := chain.NewWithHomeFlags(cmd, chainOption...) if err != nil { return err diff --git a/ignite/cmd/chain_debug.go b/ignite/cmd/chain_debug.go index 10c4fa63f5..f7bd847dcd 100644 --- a/ignite/cmd/chain_debug.go +++ b/ignite/cmd/chain_debug.go @@ -100,10 +100,8 @@ func chainDebug(cmd *cobra.Command, session *cliui.Session) error { chain.KeyringBackend(chaincmd.KeyringBackendTest), } - config, err := cmd.Flags().GetString(flagConfig) - if err != nil { - return err - } + // check if custom config is defined + config, _ := cmd.Flags().GetString(flagConfig) if config != "" { chainOptions = append(chainOptions, chain.ConfigFile(config)) } diff --git a/ignite/cmd/chain_faucet.go b/ignite/cmd/chain_faucet.go index 335d33d8fc..aa8fb12c0d 100644 --- a/ignite/cmd/chain_faucet.go +++ b/ignite/cmd/chain_faucet.go @@ -39,6 +39,11 @@ func chainFaucetHandler(cmd *cobra.Command, args []string) error { chain.CollectEvents(session.EventBus()), } + config, _ := cmd.Flags().GetString(flagConfig) + if config != "" { + chainOption = append(chainOption, chain.ConfigFile(config)) + } + c, err := chain.NewWithHomeFlags(cmd, chainOption...) if err != nil { return err diff --git a/ignite/cmd/chain_init.go b/ignite/cmd/chain_init.go index 0f61505fc3..9e2e0df825 100644 --- a/ignite/cmd/chain_init.go +++ b/ignite/cmd/chain_init.go @@ -112,6 +112,12 @@ func chainInitHandler(cmd *cobra.Command, _ []string) error { chainOption = append(chainOption, chain.CheckDependencies()) } + // check if custom config is defined + config, _ := cmd.Flags().GetString(flagConfig) + if config != "" { + chainOption = append(chainOption, chain.ConfigFile(config)) + } + c, err := chain.NewWithHomeFlags(cmd, chainOption...) if err != nil { return err