To add the confix tool, it’s required to add the ConfigCommand to your application’s root command file (e.g. simd/cmd/root.go).Import the confixCmd package:
import "cosmossdk.io/tools/confix/cmd"
Find the following line:
initRootCmd(rootCmd, encodingConfig)
After that line, add the following:
rootCmd.AddCommand( confixcmd.ConfigCommand(),)
The ConfixCommand function builds the config root command and is defined in the confixCmd package (cosmossdk.io/tools/confix/cmd).
An implementation example can be found in simapp.The command will be available as simd config.
To use Confix standalone, without having to add it in your application, install it with the following command:
go install cosmossdk.io/tools/confix/cmd/confix@latest
Currently, due to the replace directive in the Confix go.mod, it is not possible to use go install.
Building from source or importing in an application is required until that replace directive is removed.
Alternatively, for building from source, simply run make confix. The binary will be located in tools/confix.
simd config get app pruning # gets the value pruning from app.tomlsimd config get client chain-id # gets the value chain-id from client.toml
confix get ~/.simapp/config/app.toml pruning # gets the value pruning from app.tomlconfix get ~/.simapp/config/client.toml chain-id # gets the value chain-id from client.toml
simd config set app pruning "enabled" # sets the value pruning from app.tomlsimd config set client chain-id "foo-1" # sets the value chain-id from client.toml
confix set ~/.simapp/config/app.toml pruning "enabled" # sets the value pruning from app.tomlconfix set ~/.simapp/config/client.toml chain-id "foo-1" # sets the value chain-id from client.toml
At each SDK modification of the default configuration, add the default SDK config under data/v0.XX-app.toml.
This allows users to use the tool standalone.