burrow: github.com/hyperledger/burrow/config/source Index | Files

package source

import "github.com/hyperledger/burrow/config/source"

Index

Package Files

source.go

Constants

const STDINFileIdentifier = "-"

If passed this identifier try to read config from STDIN

Variables

var LogWriter io.Writer

func Cascade Uses

func Cascade(shortCircuit bool, providers ...ConfigProvider) *configSource

Builds a ConfigProvider by iterating over a cascade of ConfigProvider sources. Can be used in two distinct modes: with shortCircuit true the first successful ConfigProvider source is returned. With shortCircuit false sources appearing later are used to possibly override those appearing earlier

func DeepCopy Uses

func DeepCopy(conf interface{}) (interface{}, error)

Passed a pointer to struct creates a deep copy of the struct

func Default Uses

func Default(defaultConfig interface{}) *configSource

func EachOf Uses

func EachOf(providers ...ConfigProvider) *configSource

func Environment Uses

func Environment(key string) *configSource

Source from a single environment variable with config embedded in JSON

func File Uses

func File(configFile string, skipNonExistent bool) *configSource

Try to source config from provided file detecting the file format, is skipNonExistent is true then the provider will fall-through (skip) when the file doesn't exist, rather than returning an error

func FirstOf Uses

func FirstOf(providers ...ConfigProvider) *configSource

func FromFile Uses

func FromFile(configFile string, conf interface{}) error

func FromJSONString Uses

func FromJSONString(jsonString string, conf interface{}) error

func FromString Uses

func FromString(configString string, conf interface{}) error

func FromTOMLString Uses

func FromTOMLString(tomlString string, conf interface{}) error

func JSONString Uses

func JSONString(conf interface{}) string

func Merge Uses

func Merge(base, override interface{}) (interface{}, error)

func NewConfigProvider Uses

func NewConfigProvider(from string, skip bool, apply func(baseConfig interface{}) error) *configSource

func ReadFile Uses

func ReadFile(file string) ([]byte, error)

func ShouldSkipFile Uses

func ShouldSkipFile(file string, skipNonExistent bool) bool

func TOMLString Uses

func TOMLString(conf interface{}) string

func XDGBaseDir Uses

func XDGBaseDir(configFileName string) *configSource

Try to find config by using XDG base dir spec

type ConfigProvider Uses

type ConfigProvider interface {
    // Description of where this provider sources its config from
    From() string
    // Get the config values to the passed in baseConfig
    Apply(baseConfig interface{}) error
    // Return a copy of the provider that does nothing if skip is true
    SetSkip(skip bool) ConfigProvider
    // Whether to skip this provider
    Skip() bool
}

type Format Uses

type Format string
const (
    JSON    Format = "JSON"
    TOML    Format = "TOML"
    Unknown Format = ""
)

func DetectFormat Uses

func DetectFormat(configString string) Format

Package source imports 12 packages (graph) and is imported by 8 packages. Updated 2019-06-12. Refresh now. Tools for package owners.