gconf

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2019 License: Apache-2.0 Imports: 5 Imported by: 9

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Address

func Address(confStore Store, propName string) weave.Address

Address returns an address value stored under given name. This function panics if configuration cannot be acquired.

func Bytes

func Bytes(confStore Store, propName string) []byte

Bytes returns a bytes value stored under given name. This function panics if configuration cannot be acquired.

func Coin

func Coin(confStore Store, propName string) x.Coin

func Duration

func Duration(confStore Store, propName string) time.Duration

Duration returns a duration value stored under given name. This function panics if configuration cannot be acquired.

func Int

func Int(confStore Store, propName string) int

Int returns an integer value stored under given name. This function panics if configuration cannot be acquired.

func SetValue

func SetValue(db weave.KVStore, propName string, value interface{}) error

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.

func String

func String(confStore Store, propName string) string

String returns a string value stored under given name. This function panics if configuration cannot be acquired.

func Strings

func Strings(confStore Store, propName string) []string

Strings returns an array of string value stored under given name. This function panics if configuration cannot be acquired.

Types

type Initializer

type Initializer struct{}

Initializer fulfils the InitStater interface to load data from the genesis file

func (Initializer) FromGenesis

func (Initializer) FromGenesis(opts weave.Options, db weave.KVStore) error

FromGenesis will parse initial account info from genesis and save it to the database

type Store

type Store interface {
	Get([]byte) []byte
}

Jump to

Keyboard shortcuts

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