Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoSources is the error thrown when creating an Loader without sources ErrNoSources = errors.New("No sources provided") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is the interface used to send the HTTP request. It is implemented by http.Client.
type Config ¶
type Config struct { // Name is the name of the loader Name string // StopOnFailure tells whether a failure to load configs should closed the config and all registered closers StopOnFailure bool // Sources is a list of remote sources Sources []Source // Client is the client used to fetch the file, default is http.DefaultClient Client Client // MaxRetry is the maximum number of retries when an error occurs MaxRetry int // RetryDelay is the delay between each retry RetryDelay time.Duration // Watch sets the whether changes should be watched Watch bool // Rater is the rater to pass to the poll write Rater kwpoll.Rater // Debug sets the debug mode Debug bool }
Config is the configuration of the Loader
type Loader ¶
type Loader struct { *kwpoll.PollWatcher // contains filtered or unexported fields }
Loader loads a configuration remotely
func (*Loader) MaxRetry ¶
MaxRetry returns the MaxRetry config property, it implements the konfig.Loader interface
func (*Loader) RetryDelay ¶
RetryDelay returns the RetryDelay config property, it implements the konfig.Loader interface
func (*Loader) StopOnFailure ¶ added in v0.2.0
StopOnFailure returns whether a load failure should stop the config and the registered closers
type Source ¶
type Source struct { URL string Method string Body io.Reader Parser parser.Parser // Prepare is a function to modify request before sending it Prepare func(*http.Request) // StatusCode is the status code expected from this source // If the status code of the response is different, an error is returned. // Default is 200. StatusCode int }
Source is an HTTP source and a Parser
Click to show internal directories.
Click to hide internal directories.