# Environment Variables Example
# Copy to .env and configure (loaded at startup when present)

# Server Configuration
PORT=8787
NODE_ENV=development

# CORS
# Development: use '*' to allow all origins
# Production: specify exact origin(s), e.g., 'https://app.example.com'
CORS_ORIGIN=*

# Timeouts
HTTP_TIMEOUT_MS=30000
WS_RECONNECT_DELAY_MS=1000
WS_MAX_RECONNECT_ATTEMPTS=5

# Request Limits
REQUEST_SIZE_LIMIT=10485760
# 10MB in bytes (10 * 1024 * 1024)

# Kalshi API (for validation only, not used by relay)
# Relay forwards requests to whatever URL is in the request envelope
KALSHI_BASE_URL=https://api.elections.kalshi.com

# ── Smart Relay ──────────────────────────────────────────────────────────
# Set to 'true' to enable the smart relay mode (caches market data, streams to clients)
SMART_RELAY_ENABLED=false

# How often to re-discover markets in ms (default 300000 = 5 min)
SMART_RELAY_REFRESH_MS=300000

# Kalshi WebSocket URL (auto-derived from KALSHI_BASE_URL if not set)
# KALSHI_WS_URL=wss://api.elections.kalshi.com/trade-api/ws/v2

# Polymarket WebSocket URL
# POLYMARKET_WS_URL=wss://ws-subscriptions-clob.polymarket.com/ws/market

# Cache TTL in ms. Entries older than this are pruned. Default 24h.
CACHE_TTL_MS=86400000

# ── Authentication ───────────────────────────────────────────────────────
# Bearer token for /admin/* endpoints (key management, stream status).
# If unset, admin endpoints return 503.
# ADMIN_SECRET=your-secret-here

# Token for /stream/markets WebSocket auth (passed as ?token= query param).
# If unset, the stream is open (dev only — set this in production!).
# STREAM_TOKEN=your-stream-token-here

# ── Kalshi API Keys (for Smart Relay) ───────────────────────────────────
# Comma-separated list of accessKey:pemBase64 pairs.
# The PEM is standard base64 of the full PEM string.
# Keys are rotated round-robin. Invalid keys are auto-disabled.
# KALSHI_API_KEYS=accessKey1:pemBase64_1,accessKey2:pemBase64_2
