confix

package
v1.2.0-dev.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package confix applies changes to a Tendermint TOML configuration file, to update configurations created with an older version of Tendermint to a compatible format for a newer version.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyFixes

func ApplyFixes(ctx context.Context, doc *tomledit.Document) error

ApplyFixes transforms doc and reports whether it succeeded.

func CheckValid

func CheckValid(data []byte) error

CheckValid checks whether the specified config appears to be a valid Tendermint config file. This emulates how the node loads the config.

func GuessConfigVersion

func GuessConfigVersion(doc *tomledit.Document) string

GuessConfigVersion attempts to figure out which version of Tendermint created the specified config document. It returns "" if the creating version cannot be determined, otherwise a string of the form "vX.YY".

func LoadConfig

func LoadConfig(path string) (*tomledit.Document, error)

LoadConfig loads and parses the TOML document from path.

func Upgrade

func Upgrade(ctx context.Context, configPath, outputPath string) 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.

func WithLogWriter

func WithLogWriter(ctx context.Context, w io.Writer) context.Context

WithLogWriter returns a child of ctx with a logger attached that sends output to w. This is a convenience wrapper for transform.WithLogWriter.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL