A tiny config loader for Go.
Lumen loads environment variables, command-line flags and config files into typed structs — with validation, defaults and zero external dependencies.
Quickstart
go get github.com/lumen-go/lumen
type Config struct {
Port int `env:"PORT" default:"8080"`
Host string `env:"HOST" default:"0.0.0.0"`
Debug bool `env:"DEBUG"`
}
func main() {
var cfg Config
if err := lumen.Load(&cfg); err != nil {
log.Fatal(err)
}
log.Printf("listening on %s:%d", cfg.Host, cfg.Port)
}
Features
Typed binding
Map env, flags and files straight into your structs with tags.
Defaults & validation
Declarative defaults and required-field checks at load time.
Layered sources
Files, then env, then flags — predictable override order.
No dependencies
Pure standard library. Small, auditable, fast to compile.
Documentation
The full reference covers source precedence, custom decoders, nested structs and testing helpers. See the reference guide and changelog for details.
Changelog
v0.8.2 — fix flag parsing for repeated keys.
v0.8.0 — add file watching and hot reload.
v0.7.1 — improve error messages for missing required fields.