From 4eea4cafd3b8b1c2cd493886db524500c9dd745c Mon Sep 17 00:00:00 2001 From: anilCSE Date: Tue, 22 Jun 2021 01:20:04 +0530 Subject: [PATCH] add docs --- docs/core/cli.md | 8 +++++++- simapp/simd/cmd/root.go | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/core/cli.md b/docs/core/cli.md index 7f17e0c515e9..1a6086cf98d9 100644 --- a/docs/core/cli.md +++ b/docs/core/cli.md @@ -60,7 +60,13 @@ The root command (called `rootCmd`) is what the user first types into the comman Next is an example `rootCmd` function from the `simapp` application. It instantiates the root command, adds a [_persistent_ flag](#flags) and `PreRun` function to be run before every execution, and adds all of the necessary subcommands. -+++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/simapp/simd/cmd/root.go#L37-L93 ++++ https://github.com/cosmos/cosmos-sdk/blob/e73c64bac3392084d47e96a5b49eb7c1b5274ea8/simapp/simd/cmd/root.go#L37-L150 + +`rootCmd` has a function called `initAppConfig()` which is useful for setting the application's custom configs. +By default app uses Tendermint app config template from SDK, which can be over-written via `initAppConfig()`. +Here's an example code to override default `appConfig` and `app.toml` template. + ++++ https://github.com/cosmos/cosmos-sdk/blob/e73c64bac3392084d47e96a5b49eb7c1b5274ea8/simapp/simd/cmd/root.go#L84-L117 The root-level `status` and `keys` subcommands are common across most applications and do not interact with application state. The bulk of an application's functionality - what users can actually _do_ with it - is enabled by its `tx` and `query` commands. diff --git a/simapp/simd/cmd/root.go b/simapp/simd/cmd/root.go index 82bcee979dc0..a6cbda031419 100644 --- a/simapp/simd/cmd/root.go +++ b/simapp/simd/cmd/root.go @@ -67,7 +67,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { return err } - customAppTemplate, customAppConfig := initConfig() + customAppTemplate, customAppConfig := initAppConfig() return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig) }, @@ -78,9 +78,9 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { return rootCmd, encodingConfig } -// initConfig helps to override default appConfig template and configs. +// initAppConfig helps to override default appConfig template and configs. // return "", nil if no custom configuration is required for the application. -func initConfig() (string, interface{}) { +func initAppConfig() (string, interface{}) { // The following code snippet is just for reference. // WASMConfig defines configuration for the wasm module.