Use `config.Plan` with either `sources.FromResolvedFiles(...)` or `sources.FromConfigPlan(...)` to build layered config loading with provenance.
This example demonstrates the Glazed config-plan API in a small runnable program.
It shows how to:
sources.FromResolvedFiles(...)sources.FromConfigPlan(...)cd cmd/examples/config-plan
go run . show
This resolves:
repo.yaml from the repository root via GitRootFile(...)local.yaml from the current working directory via WorkingDirFile(...)Then it prints:
cd cmd/examples/config-plan
go run . show --explicit explicit.yaml
The explicit file is applied last, so it overrides both the repo-level and cwd-level files.
FromResolvedFiles(...)This runnable example resolves the plan explicitly first because it wants to print the plan report before loading values.
If your application does not need to inspect or print report.String() and only wants the resolved settings, the loading step can be shortened to:
sources.Execute(schema_, parsed, sources.FromConfigPlan(plan))
That direct middleware form still preserves the same config provenance metadata in parsed field history.
The most important part of the output is the parsed field history. Config-derived writes will include metadata like:
config_fileconfig_indexconfig_layerconfig_source_nameconfig_source_kindThat makes it easy to explain exactly why a final value won.
See:
cmd/examples/config-plan/main.gocmd/examples/config-plan/repo.yamlcmd/examples/config-plan/local.yamlcmd/examples/config-plan/explicit.yamlcmd/examples/config-plan/README.md