Documentation ¶
Index ¶
- func NewDynamicConfigHttpHandler(configMap map[string]DynamicConfig) http.Handler
- func ParseBool(data map[string]string, key string, defaultValue bool) bool
- func ParseDurationInSec(data map[string]string, key string, defaultValue time.Duration) time.Duration
- func ParseFloat64(data map[string]string, key string, defaultValue float64) float64
- func ParseInt64(data map[string]string, key string, defaultValue int64) int64
- func ParseStringList(data map[string]string, key string, defaultValue []string) []string
- type ConfigMapper
- type ConfigMapperInput
- type ConfigState
- type DynamicConfig
- type OnErrorCallback
- type OnUpdateCallback
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDynamicConfigHttpHandler ¶
func NewDynamicConfigHttpHandler(configMap map[string]DynamicConfig) http.Handler
func ParseDurationInSec ¶
func ParseFloat64 ¶
Types ¶
type ConfigMapper ¶
type ConfigMapper func(rawCurrent map[string]string, previous *ConfigState) (interface{}, error)
ConfigMapper parses configmap data and returns user provided object or error
type ConfigMapperInput ¶
type ConfigMapperInput struct { RawCurrent map[string]string Previous ConfigState }
type ConfigState ¶
type DynamicConfig ¶
type DynamicConfig interface { // GetBootstrap returns the configuration state loaded on bootstrap. As bootstrap state never changes. GetBootstrap() interface{} // GetRawBootstrap returns the configmap loaded on bootstrap. As bootstrap state never changes. GetRawBootstrap() map[string]string // Get returns the latest configuration state Get() interface{} // GetRaw returns the latest configmap GetRaw() map[string]string // Close stops the internal refresh process Close() }
func NewDynamicConfig ¶
func NewDynamicConfig(config *rest.Config, configMapName string, configMapper ConfigMapper, options Options) (DynamicConfig, error)
func NewDynamicConfigFromMap ¶
func NewDynamicConfigFromMap(data map[string]string, configMapper ConfigMapper, options Options) (DynamicConfig, error)
type OnErrorCallback ¶
type OnErrorCallback func(err error, previous *ConfigState)
type OnUpdateCallback ¶
type OnUpdateCallback func(current *ConfigState, previous *ConfigState)
type Options ¶
type Options struct { // If set to true, load data during initialization only, and do not refresh them. DisableDynamicUpdates bool // Update callback is called on each data evaluation both successful and failed OnUpdateCallback OnUpdateCallback // Called when there is an during config data processing OnErrorCallback OnErrorCallback // Configuration template. If set, and configmap is not found, a new one is created using this template. // If configmap is there, but some parameters are missing, there are added with the default values. Template map[string]string // If set to true, unrecognized parameters are removed from a configmap RemoveUnknownProperties bool }
Click to show internal directories.
Click to hide internal directories.