Skip to main content

tollgate validate

Validates a tollgate.yaml configuration file for syntax errors, schema compliance, and common issues.

Usage

dotset tollgate validate [path] [options]

Arguments

ArgumentDescriptionDefault
pathPath to tollgate.yaml config file./tollgate.yaml

Options

OptionDescriptionDefault
-s, --server <name>Only validate a specific server-
--jsonOutput results as JSON-
-q, --quietOnly output errors (no warnings or info)-

Examples

Basic Validation

# Validate default config file
dotset tollgate validate

# Validate specific file
dotset tollgate validate ~/configs/tollgate.yaml

Selective Validation

# Only validate postgres server config
dotset tollgate validate -s postgres

# Only validate filesystem server
dotset tollgate validate -s filesystem

CI/CD Integration

# Machine-readable JSON output
dotset tollgate validate --json

# Fail silently except for errors
dotset tollgate validate --quiet

Validation Checks

The validator checks for:

Schema Validation

  • Valid YAML syntax
  • Required fields present (version, servers)
  • Correct data types
  • Valid action values (allow, deny, prompt)

Server Configuration

  • Command is specified
  • Environment variables reference existing vars
  • Tool patterns are valid glob patterns

Policy Validation

  • Catch-all pattern exists ("*")
  • Analyzer types are valid
  • No conflicting rules

Output

Success

✓ Configuration valid: ./tollgate.yaml
  Servers: postgres, filesystem
  Total policies: 12

Warnings

⚠ Warning: No catch-all policy for server 'postgres'
  Consider adding a "*" pattern for unmatched tools

✓ Configuration valid with 1 warning

Errors

✗ Configuration error: ./tollgate.yaml

  Line 15: Invalid action 'block' for tool 'query'
  Valid actions: allow, deny, prompt

  Line 22: Missing required field 'command' for server 'filesystem'

Best Practices

  1. Always validate before deploying:
    dotset tollgate validate && dotset tollgate start -s postgres
    
  2. Add to CI/CD pipeline:
    # .github/workflows/validate.yml
    - name: Validate Tollgate config
      run: npx @dotsetlabs/cli tollgate validate --quiet
    
  3. Use JSON output for programmatic checks:
    dotset tollgate validate --json | jq '.valid'