# One test, many environments: `loadr run -e staging examples/13-environments.yaml`
# deep-merges the env block over the file. Secrets come from the process
# environment and are never printed.
name: environments
description: per-environment overrides and secrets

defaults:
  http:
    base_url: https://prod.example.com
    timeout: 10s

env:
  staging:
    defaults:
      http:
        base_url: https://staging.example.com
        tls: { insecure_skip_verify: true }   # staging has a self-signed cert
    scenarios:
      api: { vus: 2 }                          # gentler load on staging
  ci:
    scenarios:
      api: { vus: 1, duration: 10s }
    thresholds:
      http_req_duration: [ "p(95)<5000" ]      # CI machines are slow

secrets:
  api_key: { env: EXAMPLE_API_KEY }

variables:
  tenant: acme

scenarios:
  api:
    executor: constant-vus
    vus: 10
    duration: 2m
    flow:
      - request:
          name: tenant info
          url: /api/tenants/${vars.tenant}
          headers:
            X-Api-Key: ${secrets.api_key}
          checks:
            - { type: status, equals: 200 }

thresholds:
  http_req_duration: [ "p(95)<400" ]
