Dump merged configuration
Load from a YAML file and APP_* environment variables, then write the combined result to a new YAML file with WithFileDumperAs and Dump.
This is handy for debugging -- you can see exactly what Synthra resolved after merging all sources.
Run
cd examples/dump
APP_SERVER_PORT=9090 go run .
cat effective-config.yaml
You can also pass a custom output path:
go run . /tmp/my-config.yaml
Tests
cd examples/dump && go test -v
Key ideas
- Inspect the merged state --
Dump writes whatever Load produced.
- Any codec --
WithFileDumperAs accepts codec.YAML, codec.JSON, or codec.TOML.
- No side effects on Load -- the dumper only writes when you call
Dump explicitly.