plugins

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package plugins describes the xconfig provider interface. it exists to enable xconfig.Classic without circular deps.

Index

Constants

This section is empty.

Variables

View Source
var ErrUsage = errors.New("xconfig: usage request")

ErrUsage is returned when user has request usage message via some plugin, mostly flags.

Functions

func RegisterTag

func RegisterTag(name string)

RegisterTag allows providers to ensure their tag is unique. they must call this function from an init.

Types

type FieldChange added in v0.3.2

type FieldChange struct {
	// FieldName is the full flat field path, e.g. "Database.Postgres.Password".
	FieldName string
	// OldValue is the previous value.
	OldValue string
	// NewValue is the updated value.
	NewValue string
}

FieldChange describes a single config field change detected during refresh.

type Plugin

type Plugin interface {
	Parse() error
}

Plugin is the common interface for all xconfig providers.

type Refreshable added in v0.3.2

type Refreshable interface {
	Plugin
	// Refresh re-fetches values from the external source, updates changed fields,
	// and returns a list of changes. Called periodically by Config.StartRefresh.
	Refresh(ctx context.Context) ([]FieldChange, error)
}

Refreshable is implemented by plugins that support background config refresh. Examples: vault, consul, etcd, AWS SSM sourcers.

type Visitor

type Visitor interface {
	Plugin

	Visit(fields flat.Fields) error
}

Visitor is the interface for providers that require a flat view of the config, like flags, env vars.

type Walker

type Walker interface {
	Plugin

	Walk(config any) error
}

Walker is the interface for providers that take the whole config, like file loaders.

Directories

Path Synopsis
Package defaults provides default values for xconfig
Package defaults provides default values for xconfig
Package defaults provides default values for xconfig
Package defaults provides default values for xconfig
Package env provides environment variables support for xconfig
Package env provides environment variables support for xconfig
Package flag provides flags support for xconfig
Package flag provides flags support for xconfig
Package file provides config loader support for xconfig
Package file provides config loader support for xconfig
Package secret enable xconfig to integrate with secret plugins.
Package secret enable xconfig to integrate with secret plugins.

Jump to

Keyboard shortcuts

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