Documentation
¶
Overview ¶
Package runtimeconfig loads strict YAML runtime configuration through one interpolation boundary.
Index ¶
Constants ¶
const (
// DefaultConfigPath is the conventional runtime config file name.
DefaultConfigPath = "config.yml"
)
Variables ¶
var ( // ErrInvalidOptions reports an invalid loader declaration. ErrInvalidOptions = errors.New("runtimeconfig.invalid_options") // ErrInvalidValueMapping reports a non-scalar effective value mapping. ErrInvalidValueMapping = errors.New("runtimeconfig.invalid_value_mapping") // ErrMissingConfig reports a missing runtime config file. ErrMissingConfig = errors.New("runtimeconfig.missing_config") // ErrMissingSection reports a missing required config section. ErrMissingSection = errors.New("runtimeconfig.missing_section") // ErrParse reports malformed YAML or target decode failures. ErrParse = errors.New("runtimeconfig.parse") // ErrRead reports config file read failures. ErrRead = errors.New("runtimeconfig.read") // ErrValidation reports application validation failures after strict decode. ErrValidation = errors.New("runtimeconfig.validation") )
Functions ¶
This section is empty.
Types ¶
type ConfigValues ¶
type ConfigValues struct {
// contains filtered or unexported fields
}
ConfigValues exposes selected scalar values from the effective config.
func (ConfigValues) Lookup ¶
func (values ConfigValues) Lookup(key string) (string, bool)
Lookup resolves a config value by key.
func (ConfigValues) Map ¶
func (values ConfigValues) Map() map[string]string
Map returns a defensive copy of all config values.
func (ConfigValues) Resolve ¶
func (values ConfigValues) Resolve(key string) string
Resolve returns a config value by key, or empty string when absent.
func (ConfigValues) Resolver ¶
func (values ConfigValues) Resolver() func(string) string
Resolver returns a legacy string resolver backed by effective config values.
type Contract ¶
type Contract[Config any] struct { DefaultConfigPath string ExpansionLookup ExpansionLookup ValueMappings []ValueMapping Validate func(Config) error }
Contract declares a typed runtime config shape and loading behavior.
type ExpansionLookup ¶
ExpansionLookup resolves one YAML interpolation reference.
type Loaded ¶
type Loaded[Config any] struct { Path string Config Config Settings map[string]any Values ConfigValues EffectiveYAML []byte }
Loaded contains the typed config and reusable effective-config surfaces.
type Loader ¶
type Loader[Config any] struct { // contains filtered or unexported fields }
Loader loads typed runtime config values.
func (Loader[Config]) Load ¶
Load reads, validates, expands, and decodes a complete runtime config file.
type ValueMapping ¶
ValueMapping maps a scalar YAML path into the effective config value map.