Environment Resolution Strategy
CAPost supports a strict hierarchical variable resolution engine that prioritizes runtime environment values over collection variables, and overrides collection variables over global defaults.
1. Precedence Hierarchy
- CLI Injection (Highest Priority): Values passed directly via
capost-cli run --var TOKEN=xxx. - Active Environment Preset: Values defined in the currently selected Environment Workspace (e.g., "Production").
- Collection Variables: Shared defaults stored directly inside the YAML collection file.
- Global Variables (Lowest Priority): Cross-collection defaults shared across the entire vault.
2. Templating Examples
// Requesting staging servers with dynamic paths
GET {{API_GATEWAY}}/v2/customers/{{customer_id}}/invoices?limit=10&active=true
Dynamically replace values based on JSON responses using the templating engine:
POST {{API_GATEWAY}}/checkout/complete
Authorization: Bearer {{JWT_ACCESS_TOKEN}}