chainconfig

package
v0.25.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ConfigDirPath returns the path of configuration directory of Ignite.
	ConfigDirPath = xfilepath.JoinFromHome(xfilepath.Path(".ignite"))

	// ConfigFileNames is a list of recognized names as for Ignite's config file.
	ConfigFileNames = []string{"config.yml", "config.yaml"}

	// DefaultTSClientPath defines the default relative path to use when generating the TS client.
	// The path is relative to the app's directory.
	DefaultTSClientPath = "ts-client"

	// LatestVersion defines the latest version of the config.
	LatestVersion config.Version = 1

	// Versions holds config types for the supported versions.
	Versions = map[config.Version]config.Converter{
		0: &v0.Config{},
		1: &v1.Config{},
	}
)
View Source
var ErrConfigNotFound = errors.New("could not locate a config.yml in your chain")

ErrConfigNotFound indicates that the config.yml can't be found.

Functions

func CheckVersion added in v0.25.0

func CheckVersion(configFile io.Reader) error

CheckVersion checks that the config version is the latest and if not a VersionError is returned.

func CreateConfigDir

func CreateConfigDir() error

CreateConfigDir creates config directory if it is not created yet.

func FaucetHost

func FaucetHost(cfg *Config) string

FaucetHost returns the faucet host to use.

func LocateDefault

func LocateDefault(root string) (path string, err error)

LocateDefault locates the default path for the config file. Returns ErrConfigNotFound when no config file found.

func MigrateLatest added in v0.25.0

func MigrateLatest(current io.Reader, latest io.Writer) error

MigrateLatest migrates a config file to the latest version.

func ReadConfigVersion added in v0.25.0

func ReadConfigVersion(configFile io.Reader) (config.Version, error)

ReadConfigVersion reads the config version.

func TSClientPath added in v0.25.0

func TSClientPath(conf *Config) string

TSClientPath returns the relative path to the Typescript client directory. Path is relative to the app's directory.

Types

type Config

type Config = v1.Config

Config defines the latest config.

func ConvertLatest added in v0.25.0

func ConvertLatest(c config.Converter) (_ *Config, err error)

ConvertLatest converts a config to the latest version.

func DefaultConfig added in v0.25.0

func DefaultConfig() *Config

DefaultConfig returns a config for the latest version initialized with default values.

func Parse

func Parse(configFile io.Reader) (*Config, error)

Parse reads a config file. When the version of the file beign read is not the latest it is automatically migrated to the latest version.

func ParseFile

func ParseFile(path string) (*Config, error)

ParseFile parses a config from a file path.

type UnsupportedVersionError added in v0.25.0

type UnsupportedVersionError struct {
	Version config.Version
}

UnsupportedVersionError is returned when the version of the config is not supported.

func (UnsupportedVersionError) Error added in v0.25.0

func (e UnsupportedVersionError) Error() string

type ValidationError

type ValidationError struct {
	Message string
}

ValidationError is returned when a configuration is invalid.

func (ValidationError) Error

func (e ValidationError) Error() string

type VersionError added in v0.25.0

type VersionError struct {
	Version config.Version
}

VersionError is returned when config version is not the latest.

func (VersionError) Error added in v0.25.0

func (e VersionError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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