Documentation ¶
Overview ¶
Package gconf implements a configuration store intended to be used as a global, in-database configuration.
This package allows to load configuration from a genesis file and access it via set of helper functions (`String`, `Int`, `Duration` etc).
Not being able to get a configuration value is a critical condition for the application and there is no recovery path for the client. Application must be terminated and configured correctly. This is why any failure results in a panic.
Index ¶
- func Address(confStore Store, propName string) weave.Address
- func Bytes(confStore Store, propName string) []byte
- func Coin(confStore Store, propName string) coin.Coin
- func Duration(confStore Store, propName string) time.Duration
- func Int(confStore Store, propName string) int
- func SetValue(db weave.KVStore, propName string, value interface{}) error
- func String(confStore Store, propName string) string
- func Strings(confStore Store, propName string) []string
- type Initializer
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Address ¶
Address returns an address value stored under given name. This function panics if configuration cannot be acquired.
func Bytes ¶
Bytes returns a bytes value stored under given name. This function panics if configuration cannot be acquired.
func Duration ¶
Duration returns a duration value stored under given name. This function panics if configuration cannot be acquired.
func Int ¶
Int returns an integer value stored under given name. This function panics if configuration cannot be acquired.
func SetValue ¶
SetValue sets given value for the configuration property. Value must be JSON serializable. Usually this function is not needed, because genesis allows to load all at once. But it comes in handy when writing tests and only few configuration values are necessary.
Types ¶
type Initializer ¶
type Initializer struct{}
Initializer fulfils the InitStater interface to load data from the genesis file
func (Initializer) FromGenesis ¶
FromGenesis will parse initial account info from genesis and save it to the database