Skip to content

gomantics/cfgx

Repository files navigation

cfgx

Go Reference CI Go Report Card

Type-safe configuration code generation for Go. Define your config in TOML, generate strongly-typed Go code with zero runtime dependencies.

Installation

go install github.com/gomantics/cfgx/cmd/cfgx@latest

Documentation

For complete documentation, CLI reference, generation modes, and multi-environment setup, visit:

https://gomantics.dev/cfgx

Quick Example

# config.toml
[server]
addr = ":8080"
timeout = "30s"
$ cfgx generate --in config.toml --out config/config.go
// Generated code - ready to use
var Server = ServerConfig{
    Addr:    ":8080",
    Timeout: 30 * time.Second,
}

Key Features

  • Zero runtime overhead - config baked at build time
  • Compile-time type safety
  • Two generation modes: static and getter (with env var overrides)
  • File embedding support
  • Environment variable overrides
  • Multi-environment configuration

Status

v0.x.x — Production-ready for build-time configuration generation. API may introduce breaking changes between minor versions.

License

MIT