Validating Configuration Files
Flightcontrol provides a standalone CLI tool to validate your configuration files locally. This lets you catch errors before pushing to your repository.
Installation
Install the validation CLI globally:
npm install -g flightcontrol-validateOr run it directly with npx:
npx flightcontrol-validate flightcontrol.jsonUsage
# Validate a JSON config
flightcontrol-validate flightcontrol.json
# Validate a CUE config
flightcontrol-validate flightcontrol.cue
# Validate a YAML config
flightcontrol-validate flightcontrol.yamlOptions
| Option | Description |
|---|---|
--no-color | Disable ANSI colors (useful for piping) |
--quiet | Exit code only, no output |
--version | Show version |
--help | Show help |
Strict Validation
The CLI enforces strict validation, meaning any unknown or unrecognized keys in your configuration will cause validation to fail. This helps catch:
- Typos in field names (e.g.,
heathCheckPathinstead ofhealthCheckPath) - Deprecated fields that are no longer supported
- Copy-paste errors from other configurations
For example, if your config contains an unknown key:
{
"valid": false,
"file": "flightcontrol.json",
"errors": [
{
"unknownField": "Unsupported key"
}
]
}Exit Codes
| Code | Meaning |
|---|---|
0 | Config is valid |
1 | Validation errors found |
2 | File not found or parse error |
Output Examples
Valid Config
{
"valid": true,
"file": "flightcontrol.json"
}Validation Errors
{
"valid": false,
"file": "flightcontrol.json",
"errors": [
{
"environment:production": [
{
"service:Next.js App": {
"memory": "Invalid input: expected number, received string",
"healthCheckPath": "Health check path must begin with a '/' character"
}
}
]
}
]
}Parse Error
{
"valid": false,
"file": "flightcontrol.cue",
"parseError": "expected '}', found 'EOF'"
}CI Integration
Add validation to your CI pipeline to catch config errors before they reach deployment:
# GitHub Actions example
- name: Validate Flightcontrol config
run: npx flightcontrol-validate flightcontrol.json# GitLab CI example
validate-config:
script:
- npx flightcontrol-validate flightcontrol.jsonUse the --quiet flag if you only want to check the exit code without output.