Skip to content

Configuration

All configuration is done via environment variables. No config files needed.

VariableRequiredDefaultDescription
DATABASE_URLYesPostgreSQL connection string
SPARROW_SERVE_UINofalseServe the embedded web dashboard on the HTTP port
SPARROW_API_KEYNoRequire this key in X-API-Key header for all API requests
SPARROW_ENCRYPTION_KEYYes64-char hex key (32 bytes) for envelope encryption of webhook secrets and headers. Generate with openssl rand -hex 32
SPARROW_GRPC_PORTNo50051gRPC listen port. macOS users: AirPlay Receiver uses 50051 — change this or disable AirPlay Receiver in System Settings > General > AirDrop & Handoff
SPARROW_HTTP_PORTNo8080HTTP / Connect-RPC listen port (also serves the web UI)
SPARROW_ALLOW_PRIVATE_NETWORKSNofalseAllow localhost/private IP addresses as webhook URLs. Enable for local development and testing
ENVIRONMENTNodevelopment or production (affects logging/OTel)
OTEL_EXPORTER_OTLP_ENDPOINTNoOTLP HTTP endpoint for traces, metrics, and logs
CORS_ALLOWED_ORIGINSNoComma-separated list of allowed CORS origins (e.g. https://ui.example.com,https://admin.example.com). Required when the UI is hosted separately from the API. In production (ENVIRONMENT=production), cross-origin requests are blocked by default; in development, all origins are allowed.
PUBLIC_API_URLNo/API base URL for the frontend (dev only)

Sparrow encrypts webhook secrets and sensitive headers at rest using envelope encryption (AES-256-GCM). Each record gets its own random data encryption key (DEK), which is wrapped by the master key encryption key (KEK).

The encryption key is provided via the SPARROW_ENCRYPTION_KEY environment variable (64-char hex string = 32 bytes). The server will not start without it.

The key is never stored in the database. Storing the encryption key next to the data it protects defeats the purpose of encryption at rest. Use a secrets manager, Kubernetes Secret, or .env file to provide the key:

Terminal window
# Generate a key
openssl rand -hex 32
# Set it
export SPARROW_ENCRYPTION_KEY=your-64-char-hex-key
FieldStored AsEncrypted
webhook_secretBYTEAYes (envelope)
secret_headersBYTEAYes (envelope)
Event payloadsJSONBNo (plaintext)
Delivery responsesTEXTNo (plaintext)

Existing data encrypted with the previous direct AES-256-GCM format is automatically detected and decrypted. New writes always use envelope encryption.

Sparrow uses two connection pools:

PoolLibraryConfigPurpose
sqlxjmoiron/sqlxMaxOpen=25All application queries
pgxpooljackc/pgx/v5MaxConns=50, MinConns=10, 30min lifetimeRiver job queue only

Sparrow exports traces, metrics, and logs via OpenTelemetry (OTLP). Set OTEL_EXPORTER_OTLP_ENDPOINT to point to your collector:

Terminal window
OTEL_EXPORTER_OTLP_ENDPOINT=http://your-otel-collector:4318
MetricTypeDescription
webhook_registrationsCounterTotal webhook registrations
events_pushedCounterTotal events pushed
webhook_deliveriesCounterDeliveries by status
delivery_durationHistogramDelivery response time
queue_depthGaugePending jobs per queue
active_webhooksGaugeCurrently active webhooks

A default tenant (00000000-0000-0000-0000-000000000001) is auto-created on startup. All operations use this tenant. The tenant infrastructure is retained for future multi-tenant support.

Authentication is optional — set SPARROW_API_KEY to require a shared secret on all API requests. When unset, all endpoints are open (designed for internal deployments behind a VPN).