cosmos-sdk/tools/confix
dependabot[bot] 7dacef600f
build(deps): Bump cosmossdk.io/log from 1.3.1 to 1.4.0 (#21205)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-08-08 05:51:07 +00:00
..
cmd feat(confix): add migration to v2 (#21052) 2024-07-29 06:16:21 +00:00
data feat(confix): add migration to v2 (#21052) 2024-07-29 06:16:21 +00:00
testdata feat: create config fix tool (#14342) 2023-01-10 10:28:41 +00:00
.gitignore feat: create config fix tool (#14342) 2023-01-10 10:28:41 +00:00
.goreleaser.yml feat: create config fix tool (#14342) 2023-01-10 10:28:41 +00:00
CHANGELOG.md chore: add v0.50.2 changelog to main (#18682) 2023-12-11 09:19:34 +00:00
diff.go chore: fix function names (#20170) 2024-04-24 09:27:07 +00:00
doc.go feat: create config fix tool (#14342) 2023-01-10 10:28:41 +00:00
file.go refactor(confix): properly update migrate and diff command (#18596) 2023-11-30 09:59:23 +00:00
go.mod build(deps): Bump cosmossdk.io/log from 1.3.1 to 1.4.0 (#21205) 2024-08-08 05:51:07 +00:00
go.sum build(deps): Bump cosmossdk.io/log from 1.3.1 to 1.4.0 (#21205) 2024-08-08 05:51:07 +00:00
log.go feat: create config fix tool (#14342) 2023-01-10 10:28:41 +00:00
Makefile feat: create config fix tool (#14342) 2023-01-10 10:28:41 +00:00
match.go feat(confix): add migration to v2 (#21052) 2024-07-29 06:16:21 +00:00
migrations.go feat(confix): add migration to v2 (#21052) 2024-07-29 06:16:21 +00:00
README.md refactor(confix): properly update migrate and diff command (#18596) 2023-11-30 09:59:23 +00:00
sonar-project.properties chore: force reload sonar cloud (#20480) 2024-05-29 11:12:09 +00:00
upgrade_test.go style: use thelper (#16777) 2023-07-03 13:33:05 +00:00
upgrade.go feat(confix): add migration to v2 (#21052) 2024-07-29 06:16:21 +00:00

sidebar_position
1

Confix

Confix is a configuration management tool that allows you to manage your configuration via CLI.

It is based on the CometBFT RFC 019.

Installation

Add Config Command

To add the confix tool, it's required to add the ConfigCommand to your application's root command file (e.g. <appd>/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.

Using Confix Standalone

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

Alternatively, for building from source, simply run make confix. The binary will be located in tools/confix.

Usage

Use standalone:

confix --help

Use in simd:

simd config fix --help

Get

Get a configuration value, e.g.:

simd config get app pruning # gets the value pruning from app.toml
simd 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.toml
confix get ~/.simapp/config/client.toml chain-id # gets the value chain-id from client.toml

Set

Set a configuration value, e.g.:

simd config set app pruning "enabled" # sets the value pruning from app.toml
simd 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.toml
confix set ~/.simapp/config/client.toml chain-id "foo-1" # sets the value chain-id from client.toml

Migrate

Migrate a configuration file to a new version, config type defaults to app.toml, if you want to change it to client.toml, please indicate it by adding the optional parameter, e.g.:

simd config migrate v0.50 # migrates defaultHome/config/app.toml to the latest v0.50 config
simd config migrate v0.50 --client # migrates defaultHome/config/client.toml to the latest v0.50 config
confix migrate v0.50 ~/.simapp/config/app.toml # migrate ~/.simapp/config/app.toml to the latest v0.50 config
confix migrate v0.50 ~/.simapp/config/client.toml --client # migrate ~/.simapp/config/client.toml to the latest v0.50 config

Diff

Get the diff between a given configuration file and the default configuration file, e.g.:

simd config diff v0.47 # gets the diff between defaultHome/config/app.toml and the latest v0.47 config
simd config diff v0.47 --client # gets the diff between defaultHome/config/client.toml and the latest v0.47 config
confix diff v0.47 ~/.simapp/config/app.toml # gets the diff between ~/.simapp/config/app.toml and the latest v0.47 config
confix diff v0.47 ~/.simapp/config/client.toml --client # gets the diff between ~/.simapp/config/client.toml and the latest v0.47 config

View

View a configuration file, e.g:

simd config view client # views the current app client config
confix view ~/.simapp/config/client.toml # views the current app client conf

Maintainer

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.

Credits

This project is based on the CometBFT RFC 019 and their own implementation of confix.