runtimeconfig

package
v0.0.0-...-ee80a90 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: Apache-2.0 Imports: 25 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ReloadPeriod time.Duration `yaml:"period" category:"advanced"`
	// LoadPath contains the path to the runtime config files or HTTP URLs.
	// Requires a non-empty value
	LoadPath     flagext.StringSliceCSV `yaml:"file"`
	Preprocessor Preprocessor           `yaml:"-"`
	Loader       Loader                 `yaml:"-"`

	// Configurations related to fetching runtime configurations from HTTP URLs rather than local files.
	HTTPClientTimeout           time.Duration                       `yaml:"http_client_timeout" category:"advanced"`
	HTTPClientClusterValidation clusterutil.ClusterValidationConfig `yaml:"http_client_cluster_validation" category:"advanced"`
	// HTTPClientDisableKeepAlives disables HTTP keep-alives for the runtime config HTTP client.
	HTTPClientDisableKeepAlives bool `yaml:"http_client_disable_keep_alives" category:"advanced"`
}

Config holds the config for an Manager instance. It holds config related to loading per-tenant config.

func (*Config) RegisterFlags

func (mc *Config) RegisterFlags(f *flag.FlagSet)

RegisterFlags registers flags.

func (*Config) RegisterFlagsWithPrefix

func (mc *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

RegisterFlagsWithPrefix registers flags under the specified prefix, which could be empty. If a non-empty prefix is provided, it's expected to end with a dot.

type Loader

type Loader func(r io.Reader) (interface{}, error)

Loader loads the configuration from files.

type Manager

type Manager struct {
	services.Service
	// contains filtered or unexported fields
}

Manager periodically reloads the configuration from specified files, and keeps this configuration available for clients.

func New

func New(cfg Config, configName string, registerer prometheus.Registerer, logger log.Logger) (*Manager, error)

New creates an instance of Manager. Manager is a services.Service, and must be explicitly started to perform any work.

func (*Manager) CloseListenerChannel

func (om *Manager) CloseListenerChannel(listener <-chan interface{})

CloseListenerChannel removes given channel from list of channels to send notifications to and closes channel.

func (*Manager) CreateListenerChannel

func (om *Manager) CreateListenerChannel(buffer int) <-chan interface{}

CreateListenerChannel creates new channel that can be used to receive new config values. If there is no receiver waiting for value when config manager tries to send the update, or channel buffer is full, update is discarded.

When config manager is stopped, it closes all channels to notify receivers that they will not receive any more updates.

func (*Manager) GetConfig

func (om *Manager) GetConfig() interface{}

GetConfig returns last loaded config value, possibly nil.

type Preprocessor

type Preprocessor func(b []byte) ([]byte, error)

Preprocessor optionally processes and changes config prior to parsing.

Jump to

Keyboard shortcuts

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