sol-rpc-router server binary accepts command-line arguments to configure its runtime behavior.
Usage
Options
Path to the TOML configuration file.The configuration file defines backends, Redis connection, health check settings, and other router behavior. See Configuration for full details.
Short alias for
--config.Examples
Default Configuration
Run the server with the defaultconfig.toml in the current directory:
Custom Configuration Path
Specify a custom configuration file:Configuration File Format
The TOML configuration file must include:- Redis URL: For API key storage and rate limiting
- Backends: At least one upstream RPC endpoint
- Proxy settings: Timeout configuration
- Health check settings: Interval, thresholds, and probe method
Minimal Example
Hot Reload
The router supports configuration hot-reloading via SIGHUP:- The configuration file specified by
--configis re-read - New backend list and settings are loaded
- Health status is preserved for backends that still exist (matched by label)
- Router state is atomically swapped to use the new configuration
- No downtime or connection interruption occurs
Example Log Output
Server Startup
On startup, the server:- Parses command-line arguments
- Loads the configuration file from
--configpath - Validates the configuration (see Config Validation)
- Connects to Redis using the configured
redis_url - Initializes all backends as healthy
- Spawns the health check background loop
- Spawns the SIGHUP reload handler
- Starts three servers:
- HTTP server on
port(JSON-RPC + WebSocket upgrade) - WebSocket server on
port + 1(dedicated WebSocket port) - Metrics server on
metrics_port(Prometheus/metricsendpoint)
- HTTP server on
Example Startup Log
Exit Codes
The server exits with non-zero status codes on critical failures:| Code | Reason |
|---|---|
0 | Clean shutdown |
1 | Redis connection failure |
1 | Configuration load/validation error |
1 | Server binding error (port already in use) |
Environment Variables
The server itself does not read environment variables directly. However, the configuration file loaded via--config can reference environment variables in downstream tools (e.g., Redis connection pooling, TLS certificates).
For API key management, the rpc-admin CLI supports the REDIS_URL environment variable. See rpc-admin CLI for details.