config

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0, UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LocalABCI  = "local"
	SocketABCI = "socket"
)
View Source
const DefaultDirPerm = 0o700

DefaultDirPerm is the default permissions used when creating directories.

Variables

View Source
var (
	DefaultDBDir      = "db"
	DefaultConfigDir  = "config"
	DefaultSecretsDir = "secrets"

	DefaultConfigFileName = "config.toml"
)

Functions

func WriteConfigFile

func WriteConfigFile(configFilePath string, config *Config) error

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

Types

type BaseConfig

type BaseConfig struct {

	// The root directory for all data.
	// The node directory contains:
	//
	//	┌── db/
	//	│   ├── blockstore.db (folder)
	//	│   ├── gnolang.db (folder)
	//	│   └── state.db (folder)
	//	├── wal/
	//	│   └── cs.wal (folder)
	//	├── secrets/
	//	│   ├── priv_validator_state.json
	//	│   ├── node_key.json
	//	│   └── priv_validator_key.json
	//	└── config/
	//	    └── config.toml (optional)
	RootDir string `toml:"home"`

	// TCP or UNIX socket address of the ABCI application,
	// or the name of an ABCI application compiled in with the Tendermint binary,
	// or empty if local application instance.
	ProxyApp string `` /* 155-byte string literal not displayed */

	// Local application instance in lieu of remote app.
	LocalApp abci.Application `toml:"-"`

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

	// 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
	FastSyncMode bool `` /* 189-byte string literal not displayed */

	// Database backend: goleveldb | boltdb
	// * goleveldb (github.com/syndtr/goleveldb - most popular implementation)
	//   - pure go
	//   - stable
	// * boltdb (uses etcd's fork of bolt - go.etcd.io/bbolt)
	//   - EXPERIMENTAL
	//   - may be faster is some use-cases (random reads - indexer)
	//   - use boltdb build tag (go build -tags boltdb)
	DBBackend string `` /* 349-byte string literal not displayed */

	// Database directory
	DBPath string `toml:"db_dir" comment:"Database directory"`

	// Path to the JSON file containing the private key to use as a validator in the consensus protocol
	PrivValidatorKey string `` /* 137-byte string literal not displayed */

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

	// TCP or UNIX socket address for Tendermint to listen on for
	// connections from an external PrivValidator process
	PrivValidatorListenAddr string `` /* 149-byte string literal not displayed */

	// A JSON file containing the private key to use for p2p authenticated encryption
	NodeKey string `` /* 130-byte string literal not displayed */

	// Mechanism to connect to the ABCI application: local | socket
	ABCI string `toml:"abci" comment:"Mechanism to connect to the ABCI application: socket | grpc"`

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

	// 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 `` // false
	/* 149-byte string literal not displayed */
	// 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) 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

PrivValidatorKeyFile returns the full path to the priv_validator_key.json file

func (BaseConfig) PrivValidatorStateFile

func (cfg BaseConfig) PrivValidatorStateFile() string

PrivValidatorStateFile returns the full path to the priv_validator_state.json file

func (BaseConfig) ValidateBasic

func (cfg BaseConfig) ValidateBasic() error

ValidateBasic performs basic validation (checking param bounds, etc.) and returns an error if any check fails.

type Config

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

	// Options for services
	RPC          *rpc.RPCConfig       `toml:"rpc" comment:"##### rpc server configuration options #####"`
	P2P          *p2p.P2PConfig       `toml:"p2p" comment:"##### peer to peer configuration options #####"`
	Mempool      *mem.MempoolConfig   `toml:"mempool" comment:"##### mempool configuration options #####"`
	Consensus    *cns.ConsensusConfig `toml:"consensus" comment:"##### consensus configuration options #####"`
	TxEventStore *eventstore.Config   `toml:"tx_event_store" comment:"##### event store #####"`
	Telemetry    *telemetry.Config    `toml:"telemetry" comment:"##### node telemetry #####"`
}

Config defines the top level configuration for a Tendermint node

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default configuration for a Tendermint node

func LoadConfig

func LoadConfig(root string) (*Config, error)

LoadConfig loads the node configuration from disk

func LoadConfigFile

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

LoadConfigFile loads the TOML node configuration from the specified path

func LoadOrMakeConfigWithOptions

func LoadOrMakeConfigWithOptions(root string, opts ...Option) (*Config, error)

LoadOrMakeConfigWithOptions loads the configuration located in the given root directory, at [defaultConfigFilePath].

If the config does not exist, it is created, starting from the values in `DefaultConfig` and applying the defaults in opts.

func ResetTestRoot

func ResetTestRoot(testName string) (*Config, string)

func TestConfig

func TestConfig() *Config

TestConfig returns a configuration that can be used for testing

func (*Config) EnsureDirs

func (cfg *Config) EnsureDirs() error

EnsureDirs ensures default directories in root dir (and root dir).

func (*Config) SetRootDir

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

SetRootDir sets the RootDir for all Config structs

func (*Config) ValidateBasic

func (cfg *Config) ValidateBasic() error

ValidateBasic performs basic validation (checking param bounds, etc.) and returns an error if any check fails.

type Option

type Option func(cfg *Config)

Jump to

Keyboard shortcuts

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