Skip to content
This repository was archived by the owner on Jan 6, 2022. It is now read-only.

Commit d26fa00

Browse files
authored
feat(cmd): add config command (#4)
1 parent 960bc2b commit d26fa00

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cosmoscmd/root.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616

1717
"github.com/cosmos/cosmos-sdk/baseapp"
1818
"github.com/cosmos/cosmos-sdk/client"
19+
"github.com/cosmos/cosmos-sdk/client/config"
1920
"github.com/cosmos/cosmos-sdk/client/debug"
2021
"github.com/cosmos/cosmos-sdk/client/flags"
2122
"github.com/cosmos/cosmos-sdk/client/keys"
@@ -131,12 +132,18 @@ func NewRootCmd(
131132
WithInput(os.Stdin).
132133
WithAccountRetriever(types.AccountRetriever{}).
133134
WithBroadcastMode(flags.BroadcastBlock).
134-
WithHomeDir(defaultNodeHome)
135+
WithHomeDir(defaultNodeHome).
136+
WithViper("")
135137

136138
rootCmd := &cobra.Command{
137139
Use: appName + "d",
138140
Short: "Stargate CosmosHub App",
139141
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
142+
initClientCtx, err := config.ReadFromClientConfig(initClientCtx)
143+
if err != nil {
144+
return err
145+
}
146+
140147
if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil {
141148
return err
142149
}
@@ -185,6 +192,7 @@ func initRootCmd(
185192
AddGenesisAccountCmd(defaultNodeHome),
186193
tmcli.NewCompletionCmd(rootCmd, true),
187194
debug.Cmd(),
195+
config.Cmd(),
188196
)
189197

190198
a := appCreator{

0 commit comments

Comments
 (0)