Documentation
¶
Overview ¶
Package configx loads layered configuration — TOML files, an optional local overlay, environment-variable overrides, and defaults — into typed structs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Configure ¶
func Configure(envPrefix string, cfgs ...Configurable) error
Configure creates a single Reader and calls ReadConfig on each Configurable in order. Use NewViperConfigReader when you need to reuse the same parsed config across multiple calls.
Types ¶
type Configurable ¶
Configurable is implemented by any type that can populate itself from a Reader. ReadConfig is called on each registered value in order.
type Reader ¶
type Reader interface {
SetDefault(key string, value any)
Read(key string, dest any) error
ReadMap(key string) map[string]any
ReadAll(dest any) error
}
Reader wraps a reader instance and exposes config-reading operations to Configurable implementations.
func NewViperConfigReader ¶
NewViperConfigReader creates a Reader. Use this to hold a single reader across multiple Configure calls (e.g. in App.configReader) so the config file is only read once.