config

package
v0.0.0-...-c04c664 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LogFormatPlain is a format for colored text
	LogFormatPlain = "plain"
	// LogFormatJSON is a format for json output
	LogFormatJSON = "json"
)

Variables

This section is empty.

Functions

func DefaultLogLevel

func DefaultLogLevel() string

DefaultLogLevel returns a default log level of "error"

func DefaultPackageLogLevels

func DefaultPackageLogLevels() string

DefaultPackageLogLevels returns a default log level setting so all packages log at "error", while the `state` and `main` packages log at "info"

func EnsureRoot

func EnsureRoot(rootDir string)

EnsureRoot creates the root, config, and data directories if they don't exist, and panics if it fails.

func GetTmConfig

func GetTmConfig(cfg *Config) *tmConfig.Config

func WriteConfigFile

func WriteConfigFile(configFilePath string, config *Config)

WriteConfigFile renders config using the template and writes it to configFilePath.

Types

type BaseConfig

type BaseConfig struct {

	// The root directory for all data.
	// This should be set in viper so it can unmarshal into this struct
	RootDir string `mapstructure:"home"`

	// Path to the JSON file containing the initial validator set and other meta data
	Genesis string `mapstructure:"genesis_file"`

	// Path to the JSON file containing the private key to use as a validator in the consensus protocol
	PrivValidatorKey string `mapstructure:"priv_validator_key_file"`

	// Path to the JSON file containing the last sign state of a validator
	PrivValidatorState string `mapstructure:"priv_validator_state_file"`

	// TCP or UNIX socket address for Tendermint to listen on for
	// connections from an external PrivValidator process
	PrivValidatorListenAddr string `mapstructure:"priv_validator_laddr"`

	// A JSON file containing the private key to use for p2p authenticated encryption
	NodeKey string `mapstructure:"node_key_file"`

	// A custom human readable name for this node
	Moniker string `mapstructure:"moniker"`

	// TCP or UNIX socket address of the ABCI application,
	// or the name of an ABCI application compiled in with the Tendermint binary
	ProxyApp string `mapstructure:"proxy_app"`

	// Mechanism to connect to the ABCI application: socket | grpc
	ABCI string `mapstructure:"abci"`

	// Output level for logging
	LogLevel string `mapstructure:"log_level"`

	// Output format: 'plain' (colored text) or 'json'
	LogFormat string `mapstructure:"log_format"`

	// TCP or UNIX socket address for the profiling server to listen on
	ProfListenAddress string `mapstructure:"prof_laddr"`

	// If this node is many blocks behind the tip of the chain, FastSync
	// allows them to catchup quickly by downloading blocks in parallel
	// and verifying their commits
	FastSync bool `mapstructure:"fast_sync"`

	// If true, query the ABCI app on connecting to a new peer
	// so the app can decide if we should keep the connection or not
	FilterPeers bool `mapstructure:"filter_peers"` // false

	// Database backend: leveldb | memdb
	DBBackend string `mapstructure:"db_backend"`

	// Database directory
	DBPath string `mapstructure:"db_dir"`

	// Address to listen for API connections
	APIListenAddress string `mapstructure:"api_listen_addr"`

	// Address to listen for gRPC connections
	GRPCListenAddress string `mapstructure:"grpc_listen_addr"`

	// Address to listen for API v2 connections
	APIv2ListenAddress string `mapstructure:"api_v2_listen_addr"`

	ValidatorMode bool `mapstructure:"validator_mode"`

	KeepLastStates int64 `mapstructure:"keep_last_states"`

	APISimultaneousRequests int `mapstructure:"api_simultaneous_requests"`

	LogPath string `mapstructure:"log_path"`

	StateCacheSize int `mapstructure:"state_cache_size"`

	StateMemAvailable int `mapstructure:"state_mem_available"`

	HaltHeight int `mapstructure:"halt_height"`
	// contains filtered or unexported fields
}

BaseConfig defines the base configuration for a Tendermint node

func DefaultBaseConfig

func DefaultBaseConfig() BaseConfig

DefaultBaseConfig returns a default base configuration for a Tendermint node

func (BaseConfig) ChainID

func (cfg BaseConfig) ChainID() string

func (BaseConfig) DBDir

func (cfg BaseConfig) DBDir() string

DBDir returns the full path to the database directory

func (BaseConfig) GenesisFile

func (cfg BaseConfig) GenesisFile() string

GenesisFile returns the full path to the genesis.json file

func (BaseConfig) NodeKeyFile

func (cfg BaseConfig) NodeKeyFile() string

NodeKeyFile returns the full path to the node_key.json file

func (BaseConfig) PrivValidatorKeyFile

func (cfg BaseConfig) PrivValidatorKeyFile() string

func (BaseConfig) PrivValidatorStateFile

func (cfg BaseConfig) PrivValidatorStateFile() string

PrivValidatorFile returns the full path to the priv_validator.json file

type Config

type Config struct {
	// Top level options use an anonymous struct
	BaseConfig `mapstructure:",squash"`

	// Options for services
	RPC             *tmConfig.RPCConfig             `mapstructure:"rpc"`
	P2P             *tmConfig.P2PConfig             `mapstructure:"p2p"`
	Mempool         *tmConfig.MempoolConfig         `mapstructure:"mempool"`
	Consensus       *tmConfig.ConsensusConfig       `mapstructure:"consensus"`
	TxIndex         *tmConfig.TxIndexConfig         `mapstructure:"tx_index"`
	Instrumentation *tmConfig.InstrumentationConfig `mapstructure:"instrumentation"`
}

Config defines the top level configuration for a Tendermint node

func DefaultConfig

func DefaultConfig() *Config

func GetConfig

func GetConfig() *Config

func (*Config) SetRoot

func (cfg *Config) SetRoot(root string) *Config

SetRoot sets the RootDir for all Config structs

Jump to

Keyboard shortcuts

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