Documentation ¶
Overview ¶
Package config provides configuration management for the KumuluzEE microservice framework.
Index ¶
- type Bundle
- type Options
- type Util
- func (c Util) Get(key string) interface{}
- func (c Util) GetBool(key string) (value bool, ok bool)
- func (c Util) GetFloat(key string) (value float64, ok bool)
- func (c Util) GetInt(key string) (value int, ok bool)
- func (c Util) GetString(key string) (value string, ok bool)
- func (c Util) Subscribe(key string, callback func(key string, value string))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bundle ¶
Bundle is used for filling a user-defined struct with config values. Bundle should be initialized with config.NewBundle() function
type Options ¶
type Options struct { // ConfigPath is a path to configuration file, including the configuration file name. // Passing an empty string will default to config/config.yaml ConfigPath string // Additional configuration source to connect to. Possible values are: "consul", "etcd" Extension string // Additional configuration source's namespace to use (i.e. path prefix). Setting this to a // non-empty value overwrites default namespace or namespace defined in configuration file ExtensionNamespace string // LogLevel can be used to limit the amount of logging output. Default log level is 0. Level 4 // will only output Warnings and Errors, and level 5 will only output errors. // See package github.com/mc0239/logm for more details on logging and log levels. LogLevel int }
Options struct is used when instantiating a new Util or Bundle.
type Util ¶
type Util struct {
// contains filtered or unexported fields
}
Util is used for retrieving config values from available sources. Util should be initialized with config.NewUtil() function
func (Util) Get ¶
Get returns the value for a given key, stored in configuration. Configuration sources are checked by their ordinal numbers, and value is returned from first configuration source it was found in.
func (Util) GetBool ¶
GetBool is a helper method that calls Util.Get() internally and type asserts the value to bool before returning it. If value is not found in any configuration source or the value could not be type asserted to bool, a false is returned with ok equal to false.
func (Util) GetFloat ¶
GetFloat is a helper method that calls Util.Get() internally and type asserts the value to float64 before returning it. If value is not found in any configuration source or the value could not be type asserted to float64, a zero is returned with ok equal to false.
func (Util) GetInt ¶
GetInt is a helper method that calls Util.Get() internally and type asserts the value to int before returning it. If value is not found in any configuration source or the value could not be type asserted to int, a zero is returned with ok equal to false.
func (Util) GetString ¶
GetString is a helper method that calls Util.Get() internally and type asserts the value to string before returning it. If value is not found in any configuration source or the value could not be type asserted to string, an empty string is returned with ok equal to false.