GuidesFlightcontrolConfig with CodeValidating Config

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-validate

Or run it directly with npx:

npx flightcontrol-validate flightcontrol.json

Usage

# Validate a JSON config
flightcontrol-validate flightcontrol.json
 
# Validate a CUE config
flightcontrol-validate flightcontrol.cue
 
# Validate a YAML config
flightcontrol-validate flightcontrol.yaml

Options

OptionDescription
--no-colorDisable ANSI colors (useful for piping)
--quietExit code only, no output
--versionShow version
--helpShow 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., heathCheckPath instead of healthCheckPath)
  • 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

CodeMeaning
0Config is valid
1Validation errors found
2File 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.json

Use the --quiet flag if you only want to check the exit code without output.