Configuration
The backend uses the Rust config crate for configuration management. Settings can come from TOML files (local development) or environment variables (production).
Configuration Structure
Configuration is defined in apps/server/src/config/:
| File |
Purpose |
server.rs |
HTTP server settings (host, port) |
db.rs |
PostgreSQL connection (URL, pool size) |
defi.rs |
Worker scheduling intervals |
coingecko.rs |
Price API configuration |
subscription.rs |
Gelato subscription management |
services/aave.rs |
Aave-specific settings |
services/yearn.rs |
Yearn-specific settings |
services/morpho.rs |
Morpho-specific settings |
services/uniswap_v2.rs |
Uniswap V2 settings |
services/uniswap_v3.rs |
Uniswap V3 settings |
services/uniswap_v4.rs |
Uniswap V4 settings |
services/aerodrome.rs |
Aerodrome settings |
services/aerodrome_slipstream.rs |
Aerodrome CL settings |
services/krystal.rs |
Krystal API settings |
Key Settings
Server
| Setting |
Default |
Description |
host |
0.0.0.0 |
Bind address |
port |
8080 |
HTTP port |
Database
| Setting |
Default |
Description |
url |
(from env) |
PostgreSQL connection string |
max_connections |
30 |
Connection pool max |
min_connections |
10 |
Connection pool min |
connect_timeout |
30s |
Connection timeout |
Worker Schedules
| Setting |
Default |
Description |
pool_update_interval |
1800s (30 min) |
General pool refresh |
valuation_interval |
86400s (24h) |
Position USD valuation |
univ3_pool_update |
120s (2 min) |
Uniswap V3/V4 pools |
slipstream_pool_update |
120s (2 min) |
Aerodrome CL pools |
subscription_renewal |
3600s (1h) |
Payment check |
ingestion_concurrency |
30 |
Parallel fetch workers |
confirmation_concurrency |
5 |
Parallel confirmations |
Environment Variables
In production (Kubernetes), configuration comes from environment variables set via Helm:
| Variable |
Purpose |
DATABASE_URL |
PostgreSQL connection |
REDIS_URL |
Redis connection (staged) |
CLICKHOUSE_URL |
ClickHouse connection (staged) |
RPC_ENDPOINTS |
Multi-chain HTTPS RPC URLs |
WS_ENDPOINTS |
Multi-chain WebSocket RPC URLs |
MORPHO_API_TOKEN |
The Graph access token |
KRYSTAL_API_KEY |
DEX aggregation API key |
GELATO_API_KEY |
Transaction relay key |
COINGECKO_API_KEY |
Price data API key |
SENTRY_DSN |
Error reporting URL |
Local Development
For local development, create a TOML configuration file. The config crate automatically merges file-based config with environment variables, with env vars taking priority.