Documentation ¶
Index ¶
- func OverwriteConfigOpts(options []ucfg.Option)
- type Config
- func LoadFile(path string) (*Config, [md5.Size]byte, error)
- func MergeConfigs(cfgs ...*Config) (*Config, error)
- func MustNewConfigFrom(from interface{}) *Config
- func NewConfig() *Config
- func NewConfigFrom(from interface{}) (*Config, error)
- func NewConfigWithYAML(in []byte, source string) (*Config, error)
- func (c *Config) Bool(name string, idx int) (bool, error)
- func (c *Config) Child(name string, idx int) (*Config, error)
- func (c *Config) CountField(name string) (int, error)
- func (c *Config) Float(name string, idx int) (float64, error)
- func (c *Config) GetFields() []string
- func (c *Config) HasField(name string) bool
- func (c *Config) Int(name string, idx int) (int64, error)
- func (c *Config) IsArray() bool
- func (c *Config) IsDict() bool
- func (c *Config) Merge(from interface{}) error
- func (c *Config) MustName(fallback ...string) string
- func (c *Config) Name() (string, error)
- func (c *Config) Path() string
- func (c *Config) PathOf(field string) string
- func (c *Config) SetBool(name string, idx int, value bool) error
- func (c *Config) SetChild(name string, idx int, value *Config) error
- func (c *Config) SetFloat(name string, idx int, value float64) error
- func (c *Config) SetInt(name string, idx int, value int64) error
- func (c *Config) SetString(name string, idx int, value string) error
- func (c *Config) String(name string, idx int) (string, error)
- func (c *Config) Unpack(to interface{}) error
- type ConfigNamespace
- type FloatSet
- type IntSet
- type StringSet
- type UintSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OverwriteConfigOpts ¶
func OverwriteConfigOpts(options []ucfg.Option)
OverwriteConfigOpts allow to change the globally set config option
Types ¶
type Config ¶
type Config ucfg.Config
Config object to store hierarchical configurations into. See https://godoc.org/github.com/elastic/go-ucfg#Config
func MergeConfigs ¶
func MustNewConfigFrom ¶
func MustNewConfigFrom(from interface{}) *Config
MustNewConfigFrom creates a new Config object from the given input. From can be any kind of structured data (struct, map, array, slice).
If from is a string, the contents is treated like raw YAML input. The string will be parsed and a structure config object is build from the parsed result.
MustNewConfigFrom panics if an error occurs.
func NewConfigFrom ¶
NewConfigFrom creates a new Config object from the given input. From can be any kind of structured data (struct, map, array, slice).
If from is a string, the contents is treated like raw YAML input. The string will be parsed and a structure config object is build from the parsed result.
type ConfigNamespace ¶
type ConfigNamespace struct {
// contains filtered or unexported fields
}
ConfigNamespace storing at most one configuration section by name and sub-section.
func (*ConfigNamespace) Config ¶
func (ns *ConfigNamespace) Config() *Config
Config return the sub-configuration section if a section has been set.
func (*ConfigNamespace) IsSet ¶
func (ns *ConfigNamespace) IsSet() bool
IsSet returns true if a sub-configuration section has been set.
func (*ConfigNamespace) Name ¶
func (ns *ConfigNamespace) Name() string
Name returns the configuration sections it's name if a section has been set.
func (*ConfigNamespace) Unpack ¶
func (ns *ConfigNamespace) Unpack(cfg *Config) error
Unpack unpacks a configuration with at most one sub object. An sub object is ignored if it is disabled by setting `enabled: false`. If the configuration passed contains multiple active sub objects, Unpack will return an error.
type FloatSet ¶
type FloatSet map[float64]struct{}