Skip to content

Instantly share code, notes, and snippets.

@nerdalert
Created May 7, 2026 05:56
Show Gist options
  • Select an option

  • Save nerdalert/0a2028d9581bd17ea8b5463f56e85870 to your computer and use it in GitHub Desktop.

Select an option

Save nerdalert/0a2028d9581bd17ea8b5463f56e85870 to your computer and use it in GitHub Desktop.

PR Output: add --dump / -T CLI flag for effective config output

# dump a real config with conditions
  cargo run --quiet --bin praxis -- -T -c examples/configs/pipeline/conditional-filters.yaml 2>/dev/null

# Output

config_source: examples/configs/pipeline/conditional-filters.yaml
configuration:
  admin:
    address: null
    verbose: false
  body_limits:
    max_request_bytes: null
    max_response_bytes: null
  clusters: []
  filter_chains:
  - name: main
    filters:
    - filter: router
      branch_chains: null
      conditions: []
      name: null
      response_conditions: []
      failure_mode: closed
      routes:
      - path_prefix: /
        cluster: backend
    - filter: timeout
      branch_chains: null
      conditions:
      - when:
          path: null
          path_prefix: /api/
          methods: null
          headers: null
      - unless:
          path: null
          path_prefix: /healthz
          methods: null
          headers: null
      name: null
      response_conditions: []
      failure_mode: closed
      timeout_ms: 5000
    - filter: headers
      branch_chains: null
      conditions:
      - when:
          path: null
          path_prefix: null
          methods:
          - POST
          - PUT
          - PATCH
          - DELETE
          headers: null
      name: null
      response_conditions: []
      failure_mode: closed
      request_add:
      - name: X-Internal-Source
        value: gateway
    - filter: headers
      branch_chains: null
      conditions: []
      name: null
      response_conditions:
      - when:
          status:
          - 200
          headers: null
      failure_mode: closed
      response_set:
      - name: Cache-Control
        value: public, max-age=60
    - filter: load_balancer
      branch_chains: null
      conditions: []
      name: null
      response_conditions: []
      failure_mode: closed
      clusters:
      - name: backend
        endpoints:
        - 127.0.0.1:3000
  insecure_options:
    allow_open_security_filters: false
    allow_private_health_checks: false
    allow_public_admin: false
    allow_root: false
    allow_tls_without_sni: false
    allow_unbounded_body: false
    skip_pipeline_validation: false
  listeners:
  - name: default
    address: 127.0.0.1:8080
    downstream_read_timeout_ms: null
    filter_chains:
    - main
    max_connections: null
    protocol: http
    tcp_idle_timeout_ms: null
    tcp_max_duration_secs: null
    tls: null
    upstream: null
    cluster: null
  runtime:
    threads: 0
    work_stealing: true
    log_overrides: {}
    global_queue_interval: 61
    upstream_ca_file: null
    upstream_keepalive_pool_size: 64
  shutdown_timeout_secs: 30
resolved_listeners:
- name: default
  chains:
  - main
  filters:
  - chain: main
    chain_index: 0
    pipeline_index: 0
    filter: router
    name: null
    failure_mode: closed
  - chain: main
    chain_index: 1
    pipeline_index: 1
    filter: timeout
    name: null
    failure_mode: closed
  - chain: main
    chain_index: 2
    pipeline_index: 2
    filter: headers
    name: null
    failure_mode: closed
  - chain: main
    chain_index: 3
    pipeline_index: 3
    filter: headers
    name: null
    failure_mode: closed
  - chain: main
    chain_index: 4
    pipeline_index: 4
    filter: load_balancer
    name: null
    failure_mode: closed
    
# dump rejects invalid config
$ echo 'listeners: [{name: x, address: "0:80", filter_chains: [main]}]
  filter_chains: [{name: main, filters: [{filter: bogus}]}]' | \
    cargo run --quiet --bin praxis -- -T -c /dev/stdin 2>&1; echo "exit: $?"

# Output
dump failed: config: invalid YAML: did not find expected key at line 2 column 3, while parsing a block mapping
exit: 1

# conflicts with --validate
$ cargo run --quiet --bin praxis -- -T -t 2>&1; echo "exit: $?"

# Output
error: the argument '--dump' cannot be used with '--validate'

Usage: praxis --dump

For more information, try '--help'.
exit: 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment