config

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: CC0-1.0 Imports: 9 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HomePath = ""
)

Functions

func GetConfigFilePath

func GetConfigFilePath() string

GetConfigFilePath returns the path to the configuration file given the executable name

func Write

func Write(cfg Config, path string) error

Write allows to write the given configuration into the file present at the given path

Types

type ChainConfig

type ChainConfig struct {
	Bech32Prefix string   `yaml:"bech32_prefix"`
	Modules      []string `yaml:"modules"`
}

func DefaultChainConfig

func DefaultChainConfig() ChainConfig

DefaultChainConfig returns the default instance of ChainConfig

func NewChainConfig

func NewChainConfig(bech32Prefix string, modules []string) ChainConfig

NewChainConfig returns a new ChainConfig instance

func (ChainConfig) IsModuleEnabled

func (cfg ChainConfig) IsModuleEnabled(moduleName string) bool

type Config

type Config struct {
	Chain    ChainConfig           `yaml:"chain"`
	Node     nodeconfig.Config     `yaml:"node"`
	Parser   parserconfig.Config   `yaml:"parsing"`
	Database databaseconfig.Config `yaml:"database"`
	Logging  loggingconfig.Config  `yaml:"logging"`
	// contains filtered or unexported fields
}

Config defines all necessary juno configuration parameters.

var (
	// Cfg represents the configuration to be used during the execution
	Cfg Config
)

func DefaultConfig

func DefaultConfig() Config

func DefaultConfigParser

func DefaultConfigParser(configData []byte) (Config, error)

DefaultConfigParser attempts to read and parse a Juno config from the given string bytes. An error reading or parsing the config results in a panic.

func NewConfig

func NewConfig(
	nodeCfg nodeconfig.Config,
	chainCfg ChainConfig, dbConfig databaseconfig.Config,
	parserConfig parserconfig.Config, loggingConfig loggingconfig.Config,
) Config

NewConfig builds a new Config instance

func Read

func Read(configPath string, parser Parser) (Config, error)

Read takes the path to a configuration file and returns the properly parsed configuration

func (Config) GetBytes

func (c Config) GetBytes() []byte

type Parser

type Parser = func(fileContents []byte) (Config, error)

Parser represents a function that allows to parse a file contents as a Config object

Jump to

Keyboard shortcuts

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