Documentation
¶
Overview ¶
Package cfg provides a generic configuration loader for Go applications. Settings are loaded from a YAML file, supplemented with default values (the `default` tag), overridden by environment variables (the `env` tag, optionally loaded from .env files), and validated for required fields (the `required:"true"` tag).
The package does not define any application-specific structures— the configuration schema (type T) is defined by the application that uses cfg.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Load ¶
Load reads the YAML file at the specified path and any optional .env files, parses them into a value of type T, applies default values and environment variables, and then validates required fields.
Value source precedence: env > YAML > default.
envFiles is an optional list of paths to .env files. If a file does not exist, it is silently skipped. Actual process environment variables always take precedence over values loaded from .env files.
Types ¶
This section is empty.