Documentation
¶
Index ¶
- type MapProvider
- func NewDefaultMapProvider(configFileName string, properties []string) MapProvider
- func NewExpandMapProvider(base MapProvider) MapProvider
- func NewFileMapProvider(fileName string) MapProvider
- func NewInMemoryMapProvider(buf io.Reader) MapProvider
- func NewMergeMapProvider(ps ...MapProvider) MapProvider
- func NewPropertiesMapProvider(properties []string) MapProvider
- type Watchable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MapProvider ¶ added in v0.37.0
type MapProvider interface { // Get returns the config.Map if succeed or error otherwise. Get(ctx context.Context) (*config.Map, error) // Close signals that the configuration for which it was used to retrieve values is no longer in use // and the object should close and release any watchers that it may have created. // This method must be called when the service ends, either in case of success or error. Close(ctx context.Context) error }
MapProvider is an interface that helps providing configuration's parser. Implementations may load the parser from a file, a database or any other source.
func NewDefaultMapProvider ¶ added in v0.37.0
func NewDefaultMapProvider(configFileName string, properties []string) MapProvider
NewDefaultMapProvider returns the default MapProvider, and it creates configuration from a file defined by the given configFile and overwrites fields using properties.
func NewExpandMapProvider ¶ added in v0.37.0
func NewExpandMapProvider(base MapProvider) MapProvider
NewExpandMapProvider returns a MapProvider, that expands all environment variables for a config.Map provided by the given MapProvider.
func NewFileMapProvider ¶ added in v0.37.0
func NewFileMapProvider(fileName string) MapProvider
NewFileMapProvider returns a new MapProvider that reads the configuration from the given file.
func NewInMemoryMapProvider ¶ added in v0.37.0
func NewInMemoryMapProvider(buf io.Reader) MapProvider
NewInMemoryMapProvider returns a new MapProvider that reads the configuration, from the provided buffer, as YAML.
func NewMergeMapProvider ¶ added in v0.37.0
func NewMergeMapProvider(ps ...MapProvider) MapProvider
NewMergeMapProvider returns a config.MapProvider, that merges the result from multiple MapProvider.
The ConfigMaps are merged in the given order, by merging all of them in order into an initial empty map.
func NewPropertiesMapProvider ¶ added in v0.37.0
func NewPropertiesMapProvider(properties []string) MapProvider
NewPropertiesMapProvider returns a MapProvider, that provides a config.Map from the given properties.
Properties must follow the Java properties format, key-value list separated by equal sign with a "." as key delimiter.
["processors.batch.timeout=2s", "processors.batch/foo.timeout=3s"]
type Watchable ¶
type Watchable interface { // WatchForUpdate waits for updates on any of the values retrieved from config sources. // It blocks until configuration updates are received and can // return an error if anything fails. WatchForUpdate is used once during the // first evaluation of the configuration and is not used to watch configuration // changes continuously. WatchForUpdate() error }
Watchable is an extension for MapProvider that is implemented if the given provider supports monitoring of configuration updates.