Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flags

func Flags(flags *flag.FlagSet)

Flags adds flags related to basic configuration's parser loader to the flags.

Types

type Closeable

type Closeable interface {
	Close(ctx context.Context) error
}

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() (*config.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.

type Watchable

type Watchable interface {
	// WatchForUpdate is used to monitor for updates on the retrieved value.
	WatchForUpdate() error
}

Watchable is an extension for ParserProvider that is implemented if the given provider supports monitoring for configuration updates.