configuration

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package configuration holds shared configuration structs for Monet, EVM-Lite and Babble.

Index

Constants

View Source
const (
	BabbleDir   = "babble"
	EthDir      = "eth"
	KeyStoreDir = "keystore"
	POADir      = "poa"
	ServerDir   = "server"
)

Directory Constants

View Source
const (
	MonetdTomlDirDot  = ".monet"
	MonetdTomlDirCaps = "MONET"
)

Monetd Configuration Directory

View Source
const (
	PeersJSON        = "peers.json"
	PeersGenesisJSON = "peers.genesis.json"
	GenesisJSON      = "genesis.json"
	MonetTomlFile    = "monetd.toml"
	WalletTomlFile   = "wallet.toml"
	ServerPIDFile    = "server.pid"
	Chaindata        = "chaindata"
)

Filename constants

View Source
const (
	DefaultGossipPort = "1337"
	DefaultAPIAddr    = ":8080"
)

Network Constants

View Source
const (
	DefaultKeyfile        = "keyfile.json"
	DefaultPrivateKeyFile = "priv_key"
)

Keys constants

View Source
const (
	DefaultAccountBalance  = "1234567890000000000000"
	DefaultContractAddress = "abbaabbaabbaabbaabbaabbaabbaabbaabbaabba"
	GenesisContract        = "contract0.sol"
	GenesisABI             = "contract0.abi"
	CompileResultFile      = "compile.toml"
)

Genesis Constants

Variables

View Source
var (

	// Global is a global Config object used by commands in cmd/ to manipulate
	// configuration options.
	Global = DefaultConfig()
)

Functions

func DefaultConfigDir

func DefaultConfigDir(configDir string) (string, error)

DefaultConfigDir returns a the full path for the default location for a configuration file.

func DefaultMonetConfigDir

func DefaultMonetConfigDir() (string, error)

DefaultMonetConfigDir is a wrapper for DefaultConfigDir, but returns the location of the monetd configuration file.

func GlobalTOML

func GlobalTOML() (string, error)

GlobalTOML converts the global Config object into a TOML string

Types

type BabbleConfig

type BabbleConfig struct {

	// Address of Babble node (where it talks to other Babble nodes)
	BindAddr string `mapstructure:"listen"`

	// Gossip heartbeat
	Heartbeat time.Duration `mapstructure:"heartbeat"`

	// TCP timeout
	TCPTimeout time.Duration `mapstructure:"timeout"`

	// Max number of items in caches
	CacheSize int `mapstructure:"cache-size"`

	// Max number of Event in SyncResponse
	SyncLimit int `mapstructure:"sync-limit"`

	// Max number of connections in net pool
	MaxPool int `mapstructure:"max-pool"`

	// Bootstrap from database
	Bootstrap bool `mapstructure:"bootstrap"`

	// Moniker is a friendly name to indentify this peer
	Moniker string `mapstructure:"moniker"`
}

BabbleConfig contains the configuration for the Babble node used by monetd. It only presents a subset of the options Babble can accept, because monetd forces some configurations values. In particular, the --fast-sync and --store flags are disabled because monetd does not support the FastSync protocol, and it requires a persistant database.

func DefaultBabbleConfig

func DefaultBabbleConfig() *BabbleConfig

DefaultBabbleConfig returns the default configuration for a Babble node

type BaseConfig

type BaseConfig struct {

	// Top-level directory of evm-babble data
	DataDir string `mapstructure:"datadir"`

	// Verbose
	Verbose bool `mapstructure:"verbose"`

	// IP/PORT of API
	APIAddr string `mapstructure:"api-listen"`
	// contains filtered or unexported fields
}

BaseConfig contains the top level configuration for an EVM-Babble node

func DefaultBaseConfig

func DefaultBaseConfig() BaseConfig

DefaultBaseConfig returns the default top-level configuration for EVM-Babble

type Config

type Config struct {

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

	// Options for evm-lite
	Eth *EthConfig `mapstructure:"eth"`

	// Options for Babble
	Babble *BabbleConfig `mapstructure:"babble"`
}

Config contains the configuration for MONET node

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration for a MONET node

func (*Config) LogLevel

func (c *Config) LogLevel() string

LogLevel returns a logrus-style log-level based on the verbose option.

func (*Config) Logger

func (c *Config) Logger(prefix string) *logrus.Entry

Logger returns a new prefixed logrus Entry with custom formatting

func (*Config) ToBabbleConfig

func (c *Config) ToBabbleConfig() *babble_config.Config

ToBabbleConfig extracts the babble configuration and returns a config object as used by the Babble library. It enforces the values of Store and EnableFastSync to true and false respectively.

func (*Config) ToEVMLConfig

func (c *Config) ToEVMLConfig() *evml_config.Config

ToEVMLConfig extracts evm-lite configuration and returns a config object as used by the evm-lite library.

type EthConfig

type EthConfig struct {
	// Megabytes of memory allocated to internal caching (min 16MB / database forced)
	Cache int `mapstructure:"cache"`

	// Minimum gasprice for transactions submitted via this node
	MinGasPrice string `mapstructure:"min-gas-price"`
}

EthConfig contains the configuration relative to the accounts, EVM, trie/db, and service API

func DefaultEthConfig

func DefaultEthConfig() *EthConfig

DefaultEthConfig return the default configuration for Eth services

Jump to

Keyboard shortcuts

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