config

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigPath

func GetConfigPath() string

GetConfigPath returns the platform-specific default config file path

func SetExplicitConfigFile added in v1.6.0

func SetExplicitConfigFile(path string)

SetExplicitConfigFile records the highest-precedence config file path that the loader should merge on top of the default config sources. An empty string clears the override.

Types

type Loader

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

Loader handles configuration loading from multiple sources

func NewLoader

func NewLoader() *Loader

NewLoader creates a new configuration loader

func NewLoaderWithHome added in v1.6.1

func NewLoaderWithHome(home homedir.Provider) *Loader

NewLoaderWithHome allows overriding how the home directory is resolved (useful in tests).

func (*Loader) Load

func (l *Loader) Load() (*types.Config, error)

Load loads configuration from all sources with proper precedence Precedence: CLI Flags > Environment Variables > Config File > Defaults

func (*Loader) LoadDefaults

func (l *Loader) LoadDefaults()

LoadDefaults sets sensible default values

func (*Loader) LoadFromEnv

func (l *Loader) LoadFromEnv()

LoadFromEnv loads configuration from environment variables This is automatically handled by viper with AutomaticEnv() in root.go

func (*Loader) LoadFromFile

func (l *Loader) LoadFromFile() error

LoadFromFile loads configuration from YAML file

func (*Loader) LoadFromFlags

func (l *Loader) LoadFromFlags()

LoadFromFlags loads configuration from CLI flags This is automatically handled by viper flag binding in root.go

func (*Loader) Validate

func (l *Loader) Validate(config *types.Config) error

Validate validates the configuration

Jump to

Keyboard shortcuts

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