Skip to Content
ConfigurationEnvironment Variables

Environment Variables

All configuration options for the Rustrak server.

Required

VariableDescription
DATABASE_URLDatabase connection string. Optional for SQLite (defaults to sqlite:///data/rustrak.db). Required for PostgreSQL.

DATABASE_URL

Rustrak supports two database backends selected at compile time.

SQLite:

# Relative file path DATABASE_URL=sqlite://./rustrak.db # Absolute path DATABASE_URL=sqlite:///var/lib/rustrak/rustrak.db # In-memory (for testing only — data lost on restart) DATABASE_URL=sqlite::memory:

PostgreSQL:

# Format postgres://username:password@host:port/database # Examples DATABASE_URL=postgres://rustrak:rustrak@localhost:5432/rustrak DATABASE_URL=postgres://rustrak:rustrak@postgres:5432/rustrak # Docker DATABASE_URL=postgres://user:pass@host:5432/rustrak?sslmode=require # With SSL

Security

VariableDefaultDescription
SSL_PROXYfalseSet to true when behind HTTPS proxy (nginx, Cloudflare)
SESSION_SECRET_KEY(random)64-character hex string for session encryption

SSL_PROXY

Set to true when running behind a reverse proxy that terminates SSL (nginx, Cloudflare, etc.). This enables secure cookies.

SSL_PROXY=true

When SSL_PROXY=true:

  • Cookies are sent only over HTTPS (Secure flag enabled)
  • SESSION_SECRET_KEY becomes required

SESSION_SECRET_KEY

Generate with:

openssl rand -hex 32
  • Development: Optional (a random key is used, sessions don’t persist across restarts)
  • Production with SSL_PROXY=true: Required

Server

VariableDefaultDescription
HOST0.0.0.0Server bind address
PORT8080Server port
RUST_LOGinfoLog level (trace, debug, info, warn, error)

Database Pool

VariableDefaultDescription
DATABASE_MAX_CONNECTIONS10Maximum pool connections
DATABASE_MIN_CONNECTIONS1Minimum pool connections

Rate Limiting

VariableDefaultDescription
MAX_EVENTS_PER_MINUTE1000Max events/minute (global)
MAX_EVENTS_PER_HOUR10000Max events/hour (global)
MAX_EVENTS_PER_PROJECT_PER_MINUTE500Max events/minute per project
MAX_EVENTS_PER_PROJECT_PER_HOUR5000Max events/hour per project

Storage

VariableDefaultDescription
INGEST_DIR/tmp/rustrak/ingestTemporary event storage

Email Alerts (SMTP)

Global SMTP settings for email notifications. Channels can override these.

VariableDefaultDescription
SMTP_HOST-SMTP server hostname
SMTP_PORT587SMTP port (587 for STARTTLS, 465 for SSL)
SMTP_USERNAME-SMTP username
SMTP_PASSWORD-SMTP password
SMTP_FROMalerts@rustrak.localDefault sender address

Dashboard URL

VariableDefaultDescription
DASHBOARD_URLhttp://localhost:3000URL for issue links in notifications

Bootstrap

VariableDescription
CREATE_SUPERUSERCreate admin user on startup (email:password)
CREATE_SUPERUSER="admin@example.com:secure-password"

Only creates user if database is empty.

Dashboard (Next.js)

VariableDefaultDescription
RUSTRAK_API_URLhttp://localhost:8080Backend API URL

Complete Example

SQLite (development / personal)

# .env file (SQLite — image tag: latest) # Required DATABASE_URL=sqlite:///data/rustrak.db # Server HOST=0.0.0.0 PORT=8080 RUST_LOG=info # Dashboard RUSTRAK_API_URL=http://localhost:8080

PostgreSQL (production)

# .env file (PostgreSQL — image tag: postgres) # Required DATABASE_URL=postgres://rustrak:password@postgres:5432/rustrak # Security (required for production behind HTTPS proxy) SSL_PROXY=true SESSION_SECRET_KEY=a1b2c3d4e5f67890a1b2c3d4e5f67890a1b2c3d4e5f67890a1b2c3d4e5f67890 # Server HOST=0.0.0.0 PORT=8080 RUST_LOG=info # Database Pool DATABASE_MAX_CONNECTIONS=20 # Rate Limiting MAX_EVENTS_PER_MINUTE=1000 MAX_EVENTS_PER_HOUR=10000 # Dashboard RUSTRAK_API_URL=https://rustrak.yourcompany.com DASHBOARD_URL=https://rustrak.yourcompany.com # Email Alerts (optional - can also configure per-channel) SMTP_HOST=smtp.yourcompany.com SMTP_PORT=587 SMTP_USERNAME=alerts@yourcompany.com SMTP_PASSWORD=your-smtp-password SMTP_FROM=alerts@yourcompany.com
Last updated on