config

package
v2.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2025 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 added in v2.2.3

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

ConfigOption configures a Manager

func WithSources added in v2.2.0

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

WithSources adds configuration sources

type EnvSource added in v2.2.0

type EnvSource string

EnvSource loads config from environment variables

func (EnvSource) Load added in v2.2.0

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

func (EnvSource) Name added in v2.2.0

func (e EnvSource) Name() string

type FileSource added in v2.2.0

type FileSource string

FileSource loads config from a file

func (FileSource) Load added in v2.2.0

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

func (FileSource) Name added in v2.2.0

func (f FileSource) Name() string

type GlobalConfig

type GlobalConfig struct {
	Cloudflare struct {
		Token string `yaml:"token" validate:"required"`
	} `yaml:"cloudflare"`
}

GlobalConfig represents the global application configuration

type GlobalManager added in v2.2.0

type GlobalManager = Manager[GlobalConfig]

GlobalManager manages global configuration

func NewGlobalManager added in v2.2.0

func NewGlobalManager(cmd *cli.Command) (*GlobalManager, error)

NewGlobalManager creates a new global configuration manager

type Manager added in v2.2.0

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

Manager manages configuration loading and persistence

func New added in v2.2.0

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

New creates a new config manager with functional options

func (*Manager[T]) Get added in v2.2.0

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

Get returns the configuration

func (*Manager[T]) Override added in v2.2.0

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

Override replaces the entire configuration and saves it

func (*Manager[T]) Update added in v2.2.0

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

Update updates configuration and saves it

type Source added in v2.2.0

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

Source represents a configuration source

type TunnelConfig

type TunnelConfig struct {
	Tunnel  *domain.Tunnel  `yaml:"tunnel" validate:"required"`
	Ingress *domain.Ingress `yaml:"ingress" validate:"required"`
}

TunnelConfig represents tunnel-specific configuration

func ExampleTunnelConfig added in v2.2.0

func ExampleTunnelConfig() (*TunnelConfig, error)

type TunnelManager added in v2.2.0

type TunnelManager = Manager[TunnelConfig]

TunnelManager manages tunnel configuration

func NewTunnelManager added in v2.2.0

func NewTunnelManager(path string) (*TunnelManager, error)

NewTunnelManager creates a new tunnel configuration manager

Jump to

Keyboard shortcuts

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