Environment Variables
Configure secrets and application settings
Environment Variables
Environment variables allow you to configure your application without modifying code. Store API keys, database URLs, and configuration settings securely.
Overview
Environment variables in Senate:
- Are passed to your container at runtime
- Can contain sensitive data (encrypted at rest)
- Require a redeploy to take effect
- Are scoped to a single service
Managing Environment Variables
Via the Dashboard
- Navigate to your service
- Go to the Environment tab
- Add, edit, or remove variables
- Click Save

Variable Format
| Field | Description | Example |
|---|---|---|
| Key | Variable name (uppercase recommended) | DATABASE_URL |
| Value | Variable value | postgres://user:pass@host:5432/db |
Changes to environment variables require a redeploy to take effect.
Common Environment Variables
Database Connections
DATABASE_URL=postgres://user:password@host:5432/database
REDIS_URL=redis://localhost:6379
MONGODB_URI=mongodb://localhost:27017/mydbApplication Settings
NODE_ENV=production
PORT=3000
DEBUG=false
LOG_LEVEL=infoAPI Keys & Secrets
API_KEY=sk_live_xxxxx
JWT_SECRET=your-secret-key
AWS_ACCESS_KEY_ID=AKIAXXXXXXXX
AWS_SECRET_ACCESS_KEY=xxxxxxxxService URLs
BASE_URL=https://app.example.com
API_URL=http://senate-api-abc123:8080
FRONTEND_URL=https://www.example.comReferencing Other Services
For service-to-service communication, use internal hostnames:
# Format: {service-name}-{short-id}
API_URL=http://backend-abc123:8080
DATABASE_HOST=postgres-def456Find the internal hostname in the service's Domains tab under "Internal Endpoints."
Environment Variables in Compose
For Compose services, environment variables are merged:
- Variables defined in
docker-compose.yml - Variables set in Senate's Environment tab (override compose)
# docker-compose.yml
services:
app:
environment:
- NODE_ENV=development # Can be overridden in SenateVariable Lifecycle
| Action | Effect |
|---|---|
| Add variable | Available after next deploy |
| Edit variable | Takes effect after redeploy |
| Delete variable | Removed after redeploy |
Containers only receive environment variables at startup. Changing a variable requires redeploying the service.
Debugging
View Current Variables
Check what variables are set in a running container:
- Go to service Overview tab
- Open the Terminal
- Run
envorprintenv
Common Issues
Variable not available:
- Did you redeploy after adding the variable?
- Is the key spelled correctly (case-sensitive)?
Value incorrect:
- Check for trailing spaces or quotes
- Verify the value in the Environment tab
Related
- First Deployment - Initial setup
- Storage - Persistent data
- Services - Service configuration