config

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigOption

type ConfigOption[T any] func(*Manager[T]) error

func WithSources

func WithSources[T any](sources ...Source) ConfigOption[T]

type EnvSource

type EnvSource string

func (EnvSource) Load

func (e EnvSource) Load(k *koanf.Koanf) error

func (EnvSource) Name

func (e EnvSource) Name() string

type FileSource

type FileSource string

FileSource loads config from a file

func (FileSource) Load

func (f FileSource) Load(k *koanf.Koanf) error

func (FileSource) Name

func (f FileSource) Name() string

type Manager

type Manager[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any](path string, defaultConfig *T, opts ...ConfigOption[T]) (*Manager[T], error)

func (*Manager[T]) Get

func (m *Manager[T]) Get(validate bool) (*T, error)

func (*Manager[T]) Override

func (m *Manager[T]) Override(config *T) error

Override replaces the entire configuration and saves it

func (*Manager[T]) Update

func (m *Manager[T]) Update(fn func(*T)) error

Update updates configuration and saves it

type Source

type Source interface {
	Load(*koanf.Koanf) error
	Name() string
}

Source represents a configuration source

Jump to

Keyboard shortcuts

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