config

package
v5.0.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: CC0-1.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HomePath = ""
)

Functions

func GetAvgBlockTime

func GetAvgBlockTime() time.Duration

GetAvgBlockTime returns the average_block_time in the configuration file or returns 3 seconds if it is not configured

func GetConfigFilePath

func GetConfigFilePath() string

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

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, error)

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