Provide tools to validate configuration
Gitaly and Praefect are distributed in various ways:
- Charts
- Omnibus
- Source
We currently provide no way to validate configuration of Praefect or Gitaly without trying to run with the configuration. This is not ideal as the distributions would prefer to surface errors to the user as early as possible. To do so, they'd all currently have to implement their own validation logic. This is not ideal as this duplicates the configuration validation in multiple places. Keeping that logic up to date would be painful. Ideally we'd provide a tool that can be used to validate a configuration. It should take in a configuration and provide structured output of validation errors so distribution like Omnibus can surface them to users in a user friendly way.
Let's implement gitaly validate-configuration
and praefect validate-configuration
.
The tool should take in a TOML encoded configuration via stdin and return validation errors. The validation errors should be outputted as JSON for easy integration via scripts.
For example, configuring an invalid value for logging format could produce:
{
"errors": [
{"key": ["logging", "format"], "message":"invalid logging format: 'bad-format'"}
]
}
More structured fields can be added as we identify what the distributions need.
The tool continues on errors so the all of the configuration errors can be surfaced to the user in one go.
Later on, we should emit deprecation notices via the tool so the distributions can correctly warn on upcoming deprecations.