config

package
v0.63.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(path string, target interface{}) error

LoadConfig is a convenience function that loads and processes a config file

func LoadConfigWithOptions

func LoadConfigWithOptions(path string, target interface{}, options ProcessorOptions) error

LoadConfigWithOptions loads a config file with custom processor options

func ProcessYAMLString

func ProcessYAMLString(yamlStr string, target interface{}) error

ProcessYAMLString processes a YAML string with default options

Types

type Processor

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

Processor handles YAML processing with environment variable expansion and custom tags

func NewDefaultProcessor

func NewDefaultProcessor() *Processor

NewDefaultProcessor creates a processor with default options

func NewProcessor

func NewProcessor(options ProcessorOptions) *Processor

NewProcessor creates a new YAML processor with the given options

func (*Processor) LoadAndDecode

func (p *Processor) LoadAndDecode(path string, target interface{}) error

LoadAndDecode loads a YAML file, processes it, and decodes into the target struct

func (*Processor) LoadFile

func (p *Processor) LoadFile(path string) (*yaml.Node, error)

LoadFile loads and processes a YAML file, returning the processed node

func (*Processor) ProcessAndDecode

func (p *Processor) ProcessAndDecode(rawYAML []byte, target interface{}) error

ProcessAndDecode processes YAML bytes and decodes into the target struct

func (*Processor) ProcessBytes

func (p *Processor) ProcessBytes(rawYAML []byte) (*yaml.Node, error)

ProcessBytes processes raw YAML bytes and returns the processed node

func (*Processor) ProcessString

func (p *Processor) ProcessString(yamlStr string) (*yaml.Node, error)

ProcessString processes a YAML string and returns the processed node

type ProcessorOptions

type ProcessorOptions struct {
	EnableEnvVarExpansion bool
	EnableFileTag         bool
	BaseDir               string
	RequireEnvVars        bool
}

ProcessorOptions configures the YAML processor behavior

func DefaultOptions

func DefaultOptions() ProcessorOptions

DefaultOptions returns default processor options with all features enabled

type Watcher

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

Watcher watches a directory tree for file changes and calls onReload() debounced.

func NewWatcher

func NewWatcher(watchDir string, reloadDelay time.Duration, extensions []string, onReload func() error) *Watcher

NewWatcher constructs a watcher. Call w.Setup() to start. extensions: list of file extensions to watch (e.g., []string{".yaml", ".yml", ".crt", ".key", ".pem"}) If extensions is empty or nil, all files will be watched.

func (*Watcher) Close

func (w *Watcher) Close() error

func (*Watcher) Setup

func (w *Watcher) Setup() error

Setup initializes fsnotify and starts the event loop.

Jump to

Keyboard shortcuts

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