Environment Variables
Complete reference for all environment variables used to configure FireBackup Enterprise. This guide covers required variables, optional settings, and recommendations for production deployments.
Required Variables
These variables must be set for FireBackup to function:
Core Configuration
| Variable | Description | Example |
|---|---|---|
NODE_ENV | Environment mode | production |
BASE_URL | Public URL of the API | https://api.firebackup.io |
DATABASE_URL | PostgreSQL connection string | postgresql://user:pass@host:5432/db |
REDIS_URL | Redis connection string | redis://localhost:6379 |
Security
| Variable | Description | Example |
|---|---|---|
JWT_SECRET | Secret for JWT token signing (32+ bytes) | openssl rand -hex 32 |
ENCRYPTION_KEY | AES-256 encryption key (32 bytes hex) | openssl rand -hex 32 |
Google OAuth
| Variable | Description | Example |
|---|---|---|
GOOGLE_CLIENT_ID | Google OAuth client ID | xxx.apps.googleusercontent.com |
GOOGLE_CLIENT_SECRET | Google OAuth client secret | GOCSPX-xxx |
GOOGLE_CALLBACK_URL | OAuth callback URL | https://api.firebackup.io/api/v1/auth/google/callback |
License
| Variable | Description | Example |
|---|---|---|
LICENSE_KEY | FireBackup Enterprise license key | fb_lic_xxx |
Database Configuration
PostgreSQL
| Variable | Description | Default |
|---|---|---|
DATABASE_URL | Full connection string | Required |
DATABASE_POOL_MIN | Minimum pool connections | 2 |
DATABASE_POOL_MAX | Maximum pool connections | 10 |
DATABASE_SSL | Enable SSL connection | false |
DATABASE_SSL_REJECT_UNAUTHORIZED | Reject self-signed certs | true |
Connection String Format:
postgresql://USER:PASSWORD@HOST:PORT/DATABASE?schema=public&sslmode=require
Examples:
# Local development
DATABASE_URL=postgresql://postgres:password@localhost:5432/firebackup
# AWS RDS
DATABASE_URL=postgresql://admin:password@mydb.xxxxx.us-east-1.rds.amazonaws.com:5432/firebackup?sslmode=require
# Google Cloud SQL (via proxy)
DATABASE_URL=postgresql://firebackup:password@localhost:5432/firebackup
# Azure Database
DATABASE_URL=postgresql://admin@myserver:password@myserver.postgres.database.azure.com:5432/firebackup?sslmode=require
Redis
| Variable | Description | Default |
|---|---|---|
REDIS_URL | Full connection string | Required |
REDIS_HOST | Redis hostname (alternative) | localhost |
REDIS_PORT | Redis port (alternative) | 6379 |
REDIS_PASSWORD | Redis password | None |
REDIS_TLS | Enable TLS connection | false |
REDIS_DB | Redis database number | 0 |
Connection String Format:
redis://[:PASSWORD@]HOST:PORT[/DATABASE]
rediss://[:PASSWORD@]HOST:PORT[/DATABASE] # TLS
Examples:
# Local development
REDIS_URL=redis://localhost:6379
# With password
REDIS_URL=redis://:mypassword@localhost:6379
# AWS ElastiCache
REDIS_URL=redis://my-cluster.xxxxx.cache.amazonaws.com:6379
# With TLS
REDIS_URL=rediss://:password@my-cluster.xxxxx.cache.amazonaws.com:6379
Authentication
JWT Configuration
| Variable | Description | Default |
|---|---|---|
JWT_SECRET | Token signing secret | Required |
JWT_EXPIRES_IN | Token expiration | 7d |
JWT_REFRESH_EXPIRES_IN | Refresh token expiration | 30d |
JWT_ALGORITHM | Signing algorithm | HS256 |
OAuth Configuration
| Variable | Description | Default |
|---|---|---|
GOOGLE_CLIENT_ID | OAuth client ID | Required |
GOOGLE_CLIENT_SECRET | OAuth client secret | Required |
GOOGLE_CALLBACK_URL | Callback URL | Required |
OAUTH_STATE_TTL | State parameter TTL | 300 (seconds) |
Session Settings
| Variable | Description | Default |
|---|---|---|
SESSION_SECRET | Session encryption key | Uses JWT_SECRET |
SESSION_MAX_AGE | Session cookie max age | 86400000 (1 day) |
SESSION_SECURE | Secure cookie flag | true in production |
Encryption
| Variable | Description | Default |
|---|---|---|
ENCRYPTION_KEY | Master encryption key (32 bytes) | Required |
ENCRYPTION_ALGORITHM | Algorithm for backups | aes-256-gcm |
ENCRYPTION_KEY_ROTATION | Enable key rotation | false |
Generating Keys:
# Generate 32-byte hex key
openssl rand -hex 32
# Generate base64 key
openssl rand -base64 32
Storage Configuration
General Storage
| Variable | Description | Default |
|---|---|---|
DATA_DIR | Local data directory | ./data |
TEMP_DIR | Temporary file directory | /tmp/firebackup |
MAX_UPLOAD_SIZE | Maximum upload size | 500MB |
AWS S3
| Variable | Description | Default |
|---|---|---|
AWS_ACCESS_KEY_ID | AWS access key | None |
AWS_SECRET_ACCESS_KEY | AWS secret key | None |
AWS_REGION | Default AWS region | us-east-1 |
AWS_S3_ENDPOINT | Custom S3 endpoint (for MinIO) | None |
AWS_S3_FORCE_PATH_STYLE | Use path-style URLs | false |
Google Cloud Storage
| Variable | Description | Default |
|---|---|---|
GOOGLE_APPLICATION_CREDENTIALS | Path to service account JSON | None |
GCS_PROJECT_ID | GCP project ID | None |
DigitalOcean Spaces
| Variable | Description | Default |
|---|---|---|
DO_SPACES_KEY | Spaces access key | None |
DO_SPACES_SECRET | Spaces secret key | None |
DO_SPACES_REGION | Spaces region | nyc3 |
DO_SPACES_ENDPOINT | Spaces endpoint | https://nyc3.digitaloceanspaces.com |
Worker Configuration
Backup Worker
| Variable | Description | Default |
|---|---|---|
WORKER_CONCURRENCY | Concurrent backup jobs | 3 |
WORKER_MAX_RETRIES | Max job retries | 3 |
WORKER_RETRY_DELAY | Delay between retries (ms) | 5000 |
WORKER_TIMEOUT | Job timeout (ms) | 3600000 (1 hour) |
WORKER_STALLED_INTERVAL | Stalled job check interval | 30000 |
PITR Worker
| Variable | Description | Default |
|---|---|---|
PITR_ENABLED | Enable PITR functionality | true |
PITR_POLL_INTERVAL | Change polling interval (ms) | 5000 |
PITR_BATCH_SIZE | Changes per batch | 100 |
PITR_RETENTION_DAYS | Change window retention | 7 |
Queue Settings
| Variable | Description | Default |
|---|---|---|
QUEUE_PREFIX | BullMQ queue prefix | firebackup |
QUEUE_LIMITER_MAX | Rate limit max jobs | 100 |
QUEUE_LIMITER_DURATION | Rate limit window (ms) | 60000 |
Email Configuration
| Variable | Description | Default |
|---|---|---|
SMTP_HOST | SMTP server hostname | None |
SMTP_PORT | SMTP server port | 587 |
SMTP_SECURE | Use TLS | false |
SMTP_USER | SMTP username | None |
SMTP_PASS | SMTP password | None |
FROM_EMAIL | Default sender email | None |
FROM_NAME | Default sender name | FireBackup |
Example:
SMTP_HOST=smtp.sendgrid.net
SMTP_PORT=587
SMTP_USER=apikey
SMTP_PASS=SG.xxxxx
FROM_EMAIL=noreply@firebackup.io
FROM_NAME=FireBackup
Logging
| Variable | Description | Default |
|---|---|---|
LOG_LEVEL | Logging level | info |
LOG_FORMAT | Log format | json |
LOG_FILE | Log file path | None (stdout) |
LOG_MAX_SIZE | Max log file size | 100MB |
LOG_MAX_FILES | Max log file count | 5 |
Log Levels:
error- Errors onlywarn- Warnings and errorsinfo- General information (default)debug- Debug informationverbose- Detailed debug
Example:
LOG_LEVEL=info
LOG_FORMAT=json
LOG_FILE=/var/log/firebackup/app.log
Monitoring
Metrics
| Variable | Description | Default |
|---|---|---|
METRICS_ENABLED | Enable Prometheus metrics | false |
METRICS_PORT | Metrics endpoint port | 9090 |
METRICS_PATH | Metrics endpoint path | /metrics |
Health Checks
| Variable | Description | Default |
|---|---|---|
HEALTH_CHECK_ENABLED | Enable health endpoints | true |
HEALTH_CHECK_TIMEOUT | Health check timeout (ms) | 5000 |
Sentry
| Variable | Description | Default |
|---|---|---|
SENTRY_DSN | Sentry DSN for error tracking | None |
SENTRY_ENVIRONMENT | Sentry environment name | NODE_ENV |
SENTRY_TRACES_SAMPLE_RATE | Transaction sample rate | 0.1 |
Rate Limiting
| Variable | Description | Default |
|---|---|---|
RATE_LIMIT_ENABLED | Enable rate limiting | true |
RATE_LIMIT_WINDOW | Time window (ms) | 60000 |
RATE_LIMIT_MAX | Max requests per window | 100 |
RATE_LIMIT_SKIP_SUCCESSFUL | Skip successful requests | false |
CORS Configuration
| Variable | Description | Default |
|---|---|---|
CORS_ORIGIN | Allowed origins | * |
CORS_METHODS | Allowed HTTP methods | GET,POST,PUT,DELETE,PATCH |
CORS_CREDENTIALS | Allow credentials | true |
CORS_MAX_AGE | Preflight cache (seconds) | 86400 |
Example:
CORS_ORIGIN=https://app.firebackup.io,https://admin.firebackup.io
CORS_CREDENTIALS=true
Web Dashboard
| Variable | Description | Default |
|---|---|---|
VITE_API_URL | API endpoint URL | Required |
VITE_SOCKET_URL | WebSocket URL | Same as API |
VITE_SENTRY_DSN | Frontend Sentry DSN | None |
Feature Flags
| Variable | Description | Default |
|---|---|---|
FEATURE_PITR | Enable Point-in-Time Recovery | true |
FEATURE_WEBHOOKS | Enable webhooks | true |
FEATURE_AUDIT_LOG | Enable audit logging | true |
FEATURE_SSO | Enable SSO/SAML | false |
FEATURE_CUSTOM_ENCRYPTION | Enable custom encryption keys | false |
License Configuration
| Variable | Description | Default |
|---|---|---|
LICENSE_KEY | License key string | Required |
LICENSE_FILE | Path to license file | None |
LICENSE_SERVER | License server URL | https://license.firebackup.io |
LICENSE_OFFLINE | Enable offline mode | false |
Complete Example
Production .env
# ===========================================
# FireBackup Enterprise - Production Config
# ===========================================
# Core
NODE_ENV=production
BASE_URL=https://api.firebackup.io
# Database
DATABASE_URL=postgresql://firebackup:SECURE_PASSWORD@db.internal:5432/firebackup?sslmode=require
DATABASE_POOL_MAX=20
# Redis
REDIS_URL=redis://:REDIS_PASSWORD@redis.internal:6379
# Security
JWT_SECRET=your-super-secret-jwt-key-minimum-32-bytes-long
JWT_EXPIRES_IN=24h
ENCRYPTION_KEY=your-32-byte-hex-encryption-key-here
# Google OAuth
GOOGLE_CLIENT_ID=123456789.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=GOCSPX-your-client-secret
GOOGLE_CALLBACK_URL=https://api.firebackup.io/api/v1/auth/google/callback
# License
LICENSE_KEY=fb_lic_your-license-key-here
# Workers
WORKER_CONCURRENCY=5
WORKER_MAX_RETRIES=3
# Email
SMTP_HOST=smtp.sendgrid.net
SMTP_PORT=587
SMTP_USER=apikey
SMTP_PASS=SG.your-sendgrid-api-key
FROM_EMAIL=noreply@firebackup.io
FROM_NAME=FireBackup
# Logging
LOG_LEVEL=info
LOG_FORMAT=json
# Monitoring
METRICS_ENABLED=true
METRICS_PORT=9090
SENTRY_DSN=https://xxx@sentry.io/xxx
# CORS
CORS_ORIGIN=https://app.firebackup.io
# Rate Limiting
RATE_LIMIT_MAX=200
Development .env
# ===========================================
# FireBackup Enterprise - Development Config
# ===========================================
# Core
NODE_ENV=development
BASE_URL=http://localhost:4000
# Database
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/firebackup
# Redis
REDIS_URL=redis://localhost:6379
# Security
JWT_SECRET=dev-secret-not-for-production-use
ENCRYPTION_KEY=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
# Google OAuth
GOOGLE_CLIENT_ID=xxx.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=GOCSPX-xxx
GOOGLE_CALLBACK_URL=http://localhost:4000/api/v1/auth/google/callback
# License (development license)
LICENSE_KEY=fb_lic_dev_xxxxxxxx
# Logging
LOG_LEVEL=debug
LOG_FORMAT=pretty
# CORS
CORS_ORIGIN=http://localhost:3000
Environment Variable Validation
FireBackup validates required environment variables at startup. If validation fails, the application will not start:
Error: Missing required environment variables:
- DATABASE_URL
- JWT_SECRET
- GOOGLE_CLIENT_ID
Please set these variables and restart the application.
Security Best Practices
Do's
- Use strong, unique values for secrets
- Store secrets in secure secret managers
- Use environment-specific configurations
- Rotate secrets regularly
- Use SSL for database and Redis connections
Don'ts
- Don't commit
.envfiles to version control - Don't use default or example values in production
- Don't log sensitive environment variables
- Don't share secrets between environments
Secret Management
Kubernetes Secrets:
kubectl create secret generic firebackup-secrets \
--from-literal=jwt-secret=$(openssl rand -hex 32) \
--from-literal=encryption-key=$(openssl rand -hex 32)
AWS Secrets Manager:
aws secretsmanager create-secret \
--name firebackup/production \
--secret-string '{"JWT_SECRET":"xxx","ENCRYPTION_KEY":"xxx"}'
HashiCorp Vault:
vault kv put secret/firebackup/production \
JWT_SECRET="xxx" \
ENCRYPTION_KEY="xxx"
Related
- Docker Deployment - Docker configuration
- Kubernetes Deployment - K8s secrets
- Security Hardening - Security configuration
Next: Security Hardening - Production security best practices.