config

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type YAMLHotReloader

type YAMLHotReloader struct {
	// contains filtered or unexported fields
}

YAMLHotReloader is a hot reload implementation for YAML configuration files. It watches for file changes and automatically reloads the configuration.

func NewYAMLHotReloader

func NewYAMLHotReloader(path string, initialConfig any, logger *slog.Logger) (*YAMLHotReloader, error)

NewYAMLHotReloader creates a new YAML hot reloader. The initialConfig must be a pointer to a struct that will be unmarshaled from YAML.

func (*YAMLHotReloader) Close

func (h *YAMLHotReloader) Close() error

Close stops the file watcher and releases resources.

func (*YAMLHotReloader) Get

func (h *YAMLHotReloader) Get() any

Get returns the current configuration.

func (*YAMLHotReloader) OnReload

func (h *YAMLHotReloader) OnReload(fn func(any))

OnReload sets the callback function that will be called when the config is reloaded.

func (*YAMLHotReloader) Start

func (h *YAMLHotReloader) Start(ctx context.Context) error

Start begins watching the configuration file for changes. It is idempotent - calling Start multiple times has no additional effect.

Jump to

Keyboard shortcuts

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