Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Closeable ¶
Closeable is an extension interface for ParserProvider that should be added if they need to be closed.
type ParserProvider ¶
type ParserProvider interface { // Get returns the config.Parser if succeed or error otherwise. Get() (*configparser.Parser, 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.