Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ParserProvider ¶
type ParserProvider interface { // Get returns the config.Parser if succeed or error otherwise. Get(ctx context.Context) (*configparser.ConfigMap, 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 }
ParserProvider is an interface that helps providing configuration's parser. Implementations may load the parser from a file, a database or any other source.
func Default ¶
func Default() ParserProvider
Default is the default ParserProvider and it creates configuration from a file defined by the --config command line flag and overwrites properties from --set command line flag (if the flag is present).
func NewFile ¶
func NewFile() ParserProvider
NewFile returns a new ParserProvider that reads the configuration from a file configured via the --config command line flag.
func NewInMemory ¶
func NewInMemory(buf io.Reader) ParserProvider
NewInMemory returns a new ParserProvider that reads the configuration from the provided buffer as YAML.
func NewSetFlag ¶
func NewSetFlag(base ParserProvider) ParserProvider
NewSetFlag returns a config.ParserProvider, that wraps a "base" config.ParserProvider, then overrides properties from set flag(s) in the loaded Parser.
The implementation reads set flag(s) from the cmd and concatenates them as a "properties" file. Then the properties file is read and properties are set to the loaded Parser.
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 ParserProvider that is implemented if the given provider supports monitoring of configuration updates.