Environment Variables
Configure your containers with environment variables and secrets.
Variable Types
Build Variables
Available during Docker build (e.g., for private npm packages)
Runtime Variables
Available when your container runs (database URLs, API keys)
Secrets
Encrypted variables that are never logged or exposed
Adding Variables
- 1 Go to your container's Settings page
- 2 Navigate to Environment Variables
- 3 Add key-value pairs
- 4 Click Save & Restart to apply changes
Common Variables
NODE_ENV=production
DATABASE_URL=postgres://user:pass@host:5432/db
REDIS_URL=redis://host:6379
API_KEY=your-secret-api-key
PORT=3000 # Auto-set by SnapDeploy
Security Best Practices
- Never commit secrets to Git
- Use secrets for sensitive values (passwords, API keys)
- Rotate secrets regularly
- Use different values for staging and production