Documentation
¶
Overview ¶
Package confix applies changes to a Cosmos SDK TOML configuration file, to update configurations created with an older version of Cosmos SDK to a compatible format for a newer version.
Index ¶
- Constants
- Variables
- func CheckValid(fileName string, data []byte) error
- func LoadConfig(path string) (*tomledit.Document, error)
- func LoadLocalConfig(name string) (*tomledit.Document, error)
- func NoPlan(_ *tomledit.Document, to string) transform.Plan
- func PlanBuilder(from *tomledit.Document, to string, loadFn loadDestConfigFile) transform.Plan
- func PrintDiff(w io.Writer, diffs []Diff)
- func Upgrade(ctx context.Context, plan transform.Plan, configPath, outputPath string, ...) error
- func WithLogWriter(ctx context.Context, w io.Writer) context.Context
- type Diff
- type DiffType
- type KV
- type MigrationMap
Constants ¶
const ( AppConfig = "app.toml" ClientConfig = "client.toml" CMTConfig = "config.toml" )
Variables ¶
var Migrations = MigrationMap{ "v0.45": NoPlan, "v0.46": defaultPlanBuilder, "v0.47": defaultPlanBuilder, "v0.50": defaultPlanBuilder, }
Functions ¶
func CheckValid ¶
CheckValid checks whether the specified config appears to be a valid Cosmos SDK config file. It tries to unmarshal the config into both the server and client config structs.
func LoadConfig ¶
LoadConfig loads and parses the TOML document from path.
func LoadLocalConfig ¶
LoadConfig loads and parses the TOML document from confix data
func PlanBuilder ¶
PlanBuilder is a function that returns a transformation plan for a given diff between two files.
func PrintDiff ¶
PrintDiff output prints one line per key that differs: -S name -- section exists in f1 but not f2 +S name -- section exists in f2 but not f1 -M name -- mapping exists in f1 but not f2 +M name -- mapping exists in f2 but not f1
func Upgrade ¶
func Upgrade(ctx context.Context, plan transform.Plan, configPath, outputPath string, skipValidate bool) error
Upgrade reads the configuration file at configPath and applies any transformations necessary to Upgrade it to the current version. If this succeeds, the transformed output is written to outputPath. As a special case, if outputPath == "" the output is written to stdout.
It is safe if outputPath == inputPath. If a regular file outputPath already exists, it is overwritten. In case of error, the output is not written.
Upgrade is a convenience wrapper for calls to LoadConfig, ApplyFixes, and CheckValid. If the caller requires more control over the behavior of the Upgrade, call those functions directly.