provider

package
v2.10.0-dev Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2026 License: Apache-2.0, BSD-3-Clause, Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package provider resolves configuration values from multiple sources in priority order and reports telemetry for each value found.

Index

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) GetBool

func (p *Provider) GetBool(key string, def bool) bool

func (*Provider) GetDuration

func (p *Provider) GetDuration(key string, def time.Duration) time.Duration

func (*Provider) GetFloat

func (p *Provider) GetFloat(key string, def float64) float64

func (*Provider) GetFloatWithValidator

func (p *Provider) GetFloatWithValidator(key string, def float64, validate func(float64) bool) float64

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) GetInt

func (p *Provider) GetInt(key string, def int) int

func (*Provider) GetIntWithValidator

func (p *Provider) GetIntWithValidator(key string, def int, validate func(int) bool) int

func (*Provider) GetMap

func (p *Provider) GetMap(key string, def map[string]string, delimiter string) map[string]string

func (*Provider) GetString

func (p *Provider) GetString(key string, def string) string

func (*Provider) GetStringWithValidator

func (p *Provider) GetStringWithValidator(key string, def string, validate func(string) bool) string

func (*Provider) IsSet

func (p *Provider) IsSet(key string) bool

IsSet returns true if any configuration source provides a non-empty value for the key.

TODO: populate an isSet field on the Provider at the time of iterating over sources instead of re-querying them here.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL