github.com/Finschia/finschia-sdk@v0.48.1/server/doc.go (about) 1 /* 2 The commands from the SDK are defined with `cobra` and configured with the 3 `viper` package. 4 5 This takes place in the `InterceptConfigsPreRunHandler` function. 6 Since the `viper` package is used for configuration the precedence is dictated 7 by that package. That is 8 9 1. Command line switches 10 2. Environment variables 11 3. Files from configuration values 12 4. Default values 13 14 The global configuration instance exposed by the `viper` package is not 15 used by Cosmos SDK in this function. A new instance of `viper.Viper` is created 16 and the following is performed. The environmental variable prefix is set 17 to the current program name. Environmental variables consider the underscore 18 to be equivalent to the `.` or `-` character. This means that an configuration 19 value called `rpc.laddr` would be read from an environmental variable called 20 `MYTOOL_RPC_LADDR` if the current program name is `mytool`. 21 22 Running the `InterceptConfigsPreRunHandler` also reads `app.toml` 23 and `config.toml` from the home directory under the `config` directory. 24 If `config.toml` or `app.toml` do not exist then those files are created 25 and populated with default values. `InterceptConfigsPreRunHandler` takes 26 two parameters to set/update a custom template to create custom `app.toml`. 27 If these parameters are empty, the server then creates a default template 28 provided by the SDK. 29 */ 30 package server