config

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2018 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BootstrappedConfig     string = "BootstrappedConfig"
	BootstrappedConfigFile string = "BootstrappedConfigFile"
)

Bootstrap constants are keys to the value mappings in context bootstrap.

Variables

This section is empty.

Functions

func CreateConfigFile

func CreateConfigFile(args map[string]interface{}) (*viper.Viper, error)

CreateConfigFile creates minimum config file with arguments

Types

type AccountConfig

type AccountConfig struct {
	Address  string
	Key      string
	Password string
}

AccountConfig holds the account details.

type Bootstrapper

type Bootstrapper struct{}

Bootstrapper implements bootstrap.Bootstrapper to initialise config package.

func (*Bootstrapper) Bootstrap

func (*Bootstrapper) Bootstrap(context map[string]interface{}) error

Bootstrap takes the passed in config file, loads the config and puts the config back into context.

type Config

type Config interface {
	GetStoragePath() string
	GetP2PPort() int
	GetP2PExternalIP() string
	GetP2PConnectionTimeout() time.Duration
	GetReceiveEventNotificationEndpoint() string
	GetServerPort() int
	GetServerAddress() string
	GetNumWorkers() int
	GetWorkerWaitTimeMS() int
	GetEthereumNodeURL() string
	GetEthereumContextReadWaitTimeout() time.Duration
	GetEthereumContextWaitTimeout() time.Duration
	GetEthereumIntervalRetry() time.Duration
	GetEthereumMaxRetries() int
	GetEthereumGasPrice() *big.Int
	GetEthereumGasLimit() uint64
	GetEthereumDefaultAccountName() string
	GetEthereumAccount(accountName string) (account *AccountConfig, err error)
	GetTxPoolAccessEnabled() bool
	GetNetworkString() string
	GetNetworkKey(k string) string
	GetContractAddressString(address string) string
	GetContractAddress(address string) common.Address
	GetBootstrapPeers() []string
	GetNetworkID() uint32
	GetIdentityID() ([]byte, error)
	GetSigningKeyPair() (pub, priv string)
	GetEthAuthKeyPair() (pub, priv string)
}

Config defines the methods that a config type should implement.

type Configuration

type Configuration struct {
	// contains filtered or unexported fields
}

Configuration holds the configuration details for the node.

func LoadConfiguration

func LoadConfiguration(configFile string) *Configuration

LoadConfiguration loads the configuration from the given file.

func (*Configuration) Get

func (c *Configuration) Get(key string) interface{}

Get returns associated value for the key.

func (*Configuration) GetBool

func (c *Configuration) GetBool(key string) bool

GetBool returns value bool associated with key.

func (*Configuration) GetBootstrapPeers

func (c *Configuration) GetBootstrapPeers() []string

GetBootstrapPeers returns the list of configured bootstrap nodes for the given network.

func (*Configuration) GetContractAddress

func (c *Configuration) GetContractAddress(contract string) (address common.Address)

GetContractAddress returns the deployed contract address for a given contract.

func (*Configuration) GetContractAddressString

func (c *Configuration) GetContractAddressString(contract string) (address string)

GetContractAddressString returns the deployed contract address for a given contract.

func (*Configuration) GetDuration

func (c *Configuration) GetDuration(key string) time.Duration

GetDuration returns value duration associated with key.

func (*Configuration) GetEthAuthKeyPair

func (c *Configuration) GetEthAuthKeyPair() (pub, priv string)

GetEthAuthKeyPair returns ethereum key pair.

func (*Configuration) GetEthereumAccount

func (c *Configuration) GetEthereumAccount(accountName string) (account *AccountConfig, err error)

GetEthereumAccount returns the account details associated with the account name.

func (*Configuration) GetEthereumContextReadWaitTimeout

func (c *Configuration) GetEthereumContextReadWaitTimeout() time.Duration

GetEthereumContextReadWaitTimeout returns the read duration to pass for context.Deadline.

func (*Configuration) GetEthereumContextWaitTimeout

func (c *Configuration) GetEthereumContextWaitTimeout() time.Duration

GetEthereumContextWaitTimeout returns the commit duration to pass for context.Deadline.

func (*Configuration) GetEthereumDefaultAccountName

func (c *Configuration) GetEthereumDefaultAccountName() string

GetEthereumDefaultAccountName returns the default account to use for the transaction.

func (*Configuration) GetEthereumGasLimit

func (c *Configuration) GetEthereumGasLimit() uint64

GetEthereumGasLimit returns the gas limit to use for a ethereum transaction.

func (*Configuration) GetEthereumGasPrice

func (c *Configuration) GetEthereumGasPrice() *big.Int

GetEthereumGasPrice returns the gas price to use for a ethereum transaction.

func (*Configuration) GetEthereumIntervalRetry

func (c *Configuration) GetEthereumIntervalRetry() time.Duration

GetEthereumIntervalRetry returns duration to wait between retries.

func (*Configuration) GetEthereumMaxRetries

func (c *Configuration) GetEthereumMaxRetries() int

GetEthereumMaxRetries returns the max acceptable retries.

func (*Configuration) GetEthereumNodeURL

func (c *Configuration) GetEthereumNodeURL() string

GetEthereumNodeURL returns the URL of the Ethereum Node.

func (*Configuration) GetIdentityID

func (c *Configuration) GetIdentityID() ([]byte, error)

GetIdentityID returns the self centID in bytes.

func (*Configuration) GetInt

func (c *Configuration) GetInt(key string) int

GetInt returns value int associated with key.

func (*Configuration) GetNetworkID

func (c *Configuration) GetNetworkID() uint32

GetNetworkID returns the numerical network id.

func (*Configuration) GetNetworkKey

func (c *Configuration) GetNetworkKey(k string) string

GetNetworkKey returns the specific key(k) value defined in the default network.

func (*Configuration) GetNetworkString

func (c *Configuration) GetNetworkString() string

GetNetworkString returns defined network the node is connected to.

func (*Configuration) GetNumWorkers

func (c *Configuration) GetNumWorkers() int

GetNumWorkers returns number of queue workers defined in the config.

func (*Configuration) GetP2PConnectionTimeout

func (c *Configuration) GetP2PConnectionTimeout() time.Duration

GetP2PConnectionTimeout returns P2P Connect Timeout.

func (*Configuration) GetP2PExternalIP

func (c *Configuration) GetP2PExternalIP() string

GetP2PExternalIP returns P2P External IP.

func (*Configuration) GetP2PPort

func (c *Configuration) GetP2PPort() int

GetP2PPort returns P2P Port.

func (*Configuration) GetReceiveEventNotificationEndpoint

func (c *Configuration) GetReceiveEventNotificationEndpoint() string

GetReceiveEventNotificationEndpoint returns the webhook endpoint defined in the config.

func (*Configuration) GetServerAddress

func (c *Configuration) GetServerAddress() string

GetServerAddress returns the defined server address of form host:port in the config.

func (*Configuration) GetServerPort

func (c *Configuration) GetServerPort() int

GetServerPort returns the defined server port in the config.

func (*Configuration) GetSigningKeyPair

func (c *Configuration) GetSigningKeyPair() (pub, priv string)

GetSigningKeyPair returns the signing key pair.

func (*Configuration) GetStoragePath

func (c *Configuration) GetStoragePath() string

GetStoragePath returns the data storage backend.

func (*Configuration) GetString

func (c *Configuration) GetString(key string) string

GetString returns value string associated with key.

func (*Configuration) GetTxPoolAccessEnabled

func (c *Configuration) GetTxPoolAccessEnabled() bool

GetTxPoolAccessEnabled returns if the node can check the txpool for nonce increment. Note:Important flag for concurrency handling. Disable if Ethereum client doesn't support txpool API (INFURA).

func (*Configuration) GetWorkerWaitTimeMS

func (c *Configuration) GetWorkerWaitTimeMS() int

GetWorkerWaitTimeMS returns the queue worker sleep time between cycles.

func (*Configuration) InitializeViper

func (c *Configuration) InitializeViper()

InitializeViper loads viper if not loaded already. This method should not have any effects if Viper is already initialized.

func (*Configuration) IsPProfEnabled

func (c *Configuration) IsPProfEnabled() bool

IsPProfEnabled returns true if the pprof is enabled

func (*Configuration) IsSet

func (c *Configuration) IsSet(key string) bool

IsSet check if the key is set in the config.

func (*Configuration) Set

func (c *Configuration) Set(key string, value interface{})

Set update the key and the value it holds in the configuration.

func (*Configuration) SetDefault

func (c *Configuration) SetDefault(key string, value interface{})

SetDefault sets the default value for the given key.

Jump to

Keyboard shortcuts

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