Documentation ¶
Overview ¶
Package configuration holds shared configuration structs for Monet, EVM-Lite and Babble.
Index ¶
- Constants
- Variables
- func DefaultConfigDir() string
- func DefaultDataDir() string
- func DefaultKeystoreDir() string
- func DefaultMonetDir() string
- func DumpGlobalTOML(configDir, fileName string, interactive bool) error
- func GlobalTOML() (string, error)
- type BabbleConfig
- type BaseConfig
- type Config
- type EthConfig
Constants ¶
const ( // config ConfigDir = "monetd-config" BabbleDir = "babble" EthDir = "eth" POADir = "poa" // data DatabaseDir = "monetd-data" // keystore KeyStoreDir = "keystore" )
Directory Constants
const ( MonetdTomlDirDot = ".monet" MonetdTomlDirCaps = "Monet" )
Monetd Configuration Directory
const ( PeersJSON = "peers.json" PeersGenesisJSON = "peers.genesis.json" GenesisJSON = "genesis.json" MonetTomlFile = "monetd.toml" EthDB = "eth-db" BabbleDB = "babble-db" WalletTomlFile = "wallet.toml" ServerPIDFile = "server.pid" BabblePrivKey = "priv_key" )
Filename constants
const ( DefaultGossipPort = "1337" DefaultAPIAddr = ":8080" )
Network Constants
const ( DefaultKeyfile = "keyfile.json" DefaultPrivateKeyFile = "priv_key" )
Keys constants
const ( DefaultAccountBalance = "1234567890000000000000" DefaultContractAddress = "abbaabbaabbaabbaabbaabbaabbaabbaabbaabba" DefaultControllerContractAddress = "aabbaabbaabbaabbaabbaabbaabbaabbaabbaabb" GenesisContract = "contract0.sol" GenesisABI = "contract0.abi" ControllerContract = "contract1.sol" ControllerABI = "contract1.abi" CompileResultFile = "compile.toml" )
Genesis Constants
Variables ¶
var ( // Global is a global Config object used by commands in cmd/ to manipulate // configuration options. Global = DefaultConfig() )
Functions ¶
func DefaultConfigDir ¶
func DefaultConfigDir() string
DefaultConfigDir returns the full path of the config directory where static configuration files are stored.
func DefaultDataDir ¶ added in v0.3.0
func DefaultDataDir() string
DefaultDataDir returns the full path of the data directory where databases are stored.
func DefaultKeystoreDir ¶ added in v0.3.0
func DefaultKeystoreDir() string
DefaultKeystoreDir returns the full path of the keystore where encrypted keyfiles are stored.
func DefaultMonetDir ¶ added in v0.3.0
func DefaultMonetDir() string
DefaultMonetDir returns a the full path for the default location Monet configuration files based on the underlying OS.
func DumpGlobalTOML ¶ added in v0.3.0
DumpGlobalTOML takes the global Config object, encodes it into a TOML string, and writes it to a file.
func GlobalTOML ¶
GlobalTOML converts the global Config object into a TOML string
Types ¶
type BabbleConfig ¶
type BabbleConfig struct { // BindAddr is the local address:port where this node gossips with other // nodes. By default, this is "0.0.0.0", meaning Babble will bind to all // addresses on the local machine and will advertise the private IPv4 // address to the rest of the cluster. However, in some cases, there may be // a routable address that cannot be bound. Use AdvertiseAddr to enable // gossiping a different address to support this. If this address is not // routable, the node will be in a constant flapping state as other nodes // will treat the non-routability as a failure BindAddr string `mapstructure:"listen"` // AdvertiseAddr is used to change the address that we advertise to other // nodes in the cluster AdvertiseAddr string `mapstructure:"advertise"` // 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"` // MaintenanceMode when set to true causes Babble to initialise in a // suspended state. I.e. it does not start gossipping MaintenanceMode bool `mapstructure:"maintenance-mode"` // 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 { // ConfigDir contains static configuration files ConfigDir string `mapstructure:"config"` // DataDir contains babble and eth databases DataDir string `mapstructure:"data"` // 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) 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