Documentation
¶
Overview ¶
Package provider resolves configuration values from multiple sources in priority order and reports telemetry for each value found.
Index ¶
- type Provider
- func (p *Provider) GetBool(key string, def bool) bool
- func (p *Provider) GetDuration(key string, def time.Duration) time.Duration
- func (p *Provider) GetFloat(key string, def float64) float64
- func (p *Provider) GetFloatWithValidator(key string, def float64, validate func(float64) bool) float64
- func (p *Provider) GetFloatWithValidatorOrigin(key string, def float64, validate func(float64) bool) (float64, telemetry.Origin)
- func (p *Provider) GetInt(key string, def int) int
- func (p *Provider) GetIntWithValidator(key string, def int, validate func(int) bool) int
- func (p *Provider) GetMap(key string, def map[string]string, delimiter string) map[string]string
- func (p *Provider) GetString(key string, def string) string
- func (p *Provider) GetStringWithValidator(key string, def string, validate func(string) bool) string
- func (p *Provider) IsSet(key string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider resolves configuration values from an ordered list of sources. Sources are listed in descending priority order: the first source wins.
func New ¶
func New() *Provider
New returns a Provider configured with the following source list, in descending order of priority.
func (*Provider) GetDuration ¶
func (*Provider) GetFloatWithValidator ¶
func (*Provider) GetFloatWithValidatorOrigin ¶
func (p *Provider) GetFloatWithValidatorOrigin(key string, def float64, validate func(float64) bool) (float64, telemetry.Origin)
GetFloatWithValidatorOrigin is like GetFloatWithValidator but also returns the origin of the winning configuration source. Use this when the caller needs to know where the value came from (e.g. to pass to DynamicConfig).
func (*Provider) GetIntWithValidator ¶
func (*Provider) GetStringWithValidator ¶
Click to show internal directories.
Click to hide internal directories.