Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Name is the name of the loader Name string // Client is the consul KV client Client *api.Client // StopOnFailure tells wether a load failure(after the retries) leads to closing the config and all registered closers StopOnFailure bool // Keys is the list of keys to fetch Keys []Key // Timeout is the timeout duration when fetching a key Timeout time.Duration // Prefix is a prefix to prepend keys when adding into the konfig.Store Prefix string // Replacer is a Replacer for the key before adding to the konfig.Store Replacer nstrings.Replacer // Watch tells if there should be a watcher with the loader Watch bool // Rater is the rater to pass to the poll watcher Rater kwpoll.Rater // MaxRetry is the maximum number of times we can retry to load if it fails MaxRetry int // RetryDelay is the time between each retry when a load fails RetryDelay time.Duration // Debug sets debug mode on the consulloader Debug bool // Logger is used across this package to produce logs Logger nlogger.Provider // StrictMode will raise error if key was not found // In false state, konfig will try to reload desired key(s) // up until they are not found StrictMode bool // contains filtered or unexported fields }
Config is the structure representing the config of a Loader
type ConsulKV ¶
type ConsulKV interface {
Get(key string, q *api.QueryOptions) (*api.KVPair, *api.QueryMeta, error)
}
ConsulKV is an interface that consul client.KV implements. It is used to retrieve keys.
type Key ¶
type Key struct { // Key is the consul key Key string // Parser is the parser for the key // If nil, the value is casted to a string before adding to the config.Store Parser parser.Parser // QueryOptions is the query options to pass when retrieving the key from consul QueryOptions *api.QueryOptions }
Key is an Consul Key to load
type Loader ¶
type Loader struct { *kwpoll.PollWatcher // contains filtered or unexported fields }
Loader is the structure of a loader
func (*Loader) Load ¶
Load implements konfig.Loader, it loads environment variables into the konfig.Store based on config passed to the loader
func (*Loader) RetryDelay ¶
RetryDelay is the delay between each retry
func (*Loader) StopOnFailure ¶
StopOnFailure returns wether a load failure should stop the config and the registered closers
Click to show internal directories.
Click to hide internal directories.