config

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: Apache-2.0, Apache-2.0 Imports: 14 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	RUNTIME_ENV     = "ANGINE_RUNTIME"
	DEFAULT_RUNTIME = ".genesis"
	DATADIR         = "data"
	ARCHIVEDIR      = "data/archive"
	CONFIGFILE      = "config.toml"
)
View Source
const CONFIGTPL = `` /* 299-byte string literal not displayed */

Variables

This section is empty.

Functions

func DefaultConfig

func DefaultConfig() (conf *viper.Viper)

func GenChainID

func GenChainID() string

func InitConfig

func InitConfig(root, chainID string, setConf *viper.Viper) (*viper.Viper, error)

func InitRuntime

func InitRuntime(root string, chainId string, setConf *viper.Viper) error

InitRuntime makes all the necessary directorys for angine's runtime and generate the config template for you if it is not there already

func ReadConfig

func ReadConfig(root string) (*viper.Viper, error)

ReadConfig returns a ready-to-go config instance with all defaults filled in

func SetDefaults

func SetDefaults(runtime string, conf *viper.Viper) *viper.Viper

SetDefaults sets all the default configs for angine

Types

type Config

type Config interface {
	Get(key string) interface{}
	GetBool(key string) bool
	GetFloat64(key string) float64
	GetInt(key string) int
	GetString(key string) string
	GetStringSlice(key string) []string
	GetTime(key string) time.Time
	GetMap(key string) map[string]interface{}
	GetMapString(key string) map[string]string
	GetConfig(key string) Config
	IsSet(key string) bool
	Set(key string, value interface{})
	SetDefault(key string, value interface{})
}

type MapConfig

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

func NewMapConfig

func NewMapConfig(data map[string]interface{}) *MapConfig

func ReadMapConfigFromFile

func ReadMapConfigFromFile(filePath string) (*MapConfig, error)

func (*MapConfig) Get

func (cfg *MapConfig) Get(key string) interface{}

func (*MapConfig) GetBool

func (cfg *MapConfig) GetBool(key string) bool

func (*MapConfig) GetConfig

func (cfg *MapConfig) GetConfig(key string) Config

func (*MapConfig) GetFloat64

func (cfg *MapConfig) GetFloat64(key string) float64

func (*MapConfig) GetInt

func (cfg *MapConfig) GetInt(key string) int

func (*MapConfig) GetMap

func (cfg *MapConfig) GetMap(key string) map[string]interface{}

func (*MapConfig) GetMapString

func (cfg *MapConfig) GetMapString(key string) map[string]string

func (*MapConfig) GetString

func (cfg *MapConfig) GetString(key string) string

func (*MapConfig) GetStringSlice

func (cfg *MapConfig) GetStringSlice(key string) []string

func (*MapConfig) GetTime

func (cfg *MapConfig) GetTime(key string) time.Time

func (*MapConfig) IsSet

func (cfg *MapConfig) IsSet(key string) bool

func (*MapConfig) Set

func (cfg *MapConfig) Set(key string, value interface{})

func (*MapConfig) SetDefault

func (cfg *MapConfig) SetDefault(key string, value interface{})

func (*MapConfig) SetRequired

func (cfg *MapConfig) SetRequired(key string)

Jump to

Keyboard shortcuts

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