Advanced Configuration & Enterprise Parameters
Fine-grained environment variables, connection pool tuning, and 4-tier cache cascade controls.
1. Server Settings Specification (shared/config/settings.py)
| Parameter Key | Type | Default | Description |
|---|---|---|---|
ENVIRONMENT |
string | prod |
Operational environment: prod, dev, local. Normalizes Redis key prefixes. |
DATABASE_URL |
string | Required | AsyncPG PostgreSQL connection URI with SSL mode enabled. |
REDIS_URL |
string | Required | Upstash rediss:// endpoint URI supporting database index 0. |
BACKEND_CORS_ORIGINS |
list[string] | ["*"] |
Whitelisted CORS origins supporting Vercel frontend domains. |
CACHE_TTL_SHORT |
integer | 60 |
L1 memory cache lifespan for volatile spot price data (seconds). |
CACHE_TTL_LONG |
integer | 86400 |
L1 memory cache lifespan for daily market intelligence briefs (seconds). |
2. 4-Tier Upstash Redis Fallback Cascade
The search query engine implements a 4-tier key resolution algorithm to guarantee high cache availability across diverse build environments:
# Cache Resolution Order:
1. infraindex:{ENVIRONMENT}:global_view:{hw_type}:list # Active Environment Key
2. infraindex:prod:global_view:{hw_type}:list # Production Snapshot Key
3. infraindex:dev:global_view:{hw_type}:list # Development Backup Key
4. global_view:{hw_type}:list # Unprefixed Root Key
5. DB Fallback (Neon PostgreSQL Composite Index) # Cold Database Query
3. Crawler Concurrency & Rate Limiting
# Crawler Pool Settings (apps/batch/worker/crawler_pool.py)
MAX_CONCURRENT_CRAWLERS = 5 # Maximum simultaneous HTTP workers
REQUEST_TIMEOUT_SECONDS = 30 # Network socket timeout per CSP
RETRY_MAX_ATTEMPTS = 3 # Exponential backoff retry limit
CACHE_WARM_ON_COMPLETE = True # Automatically triggers Vercel Edge cache warm