Senate

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

  1. Navigate to your service
  2. Go to the Environment tab
  3. Add, edit, or remove variables
  4. Click Save

Environment variables editor

Variable Format

FieldDescriptionExample
KeyVariable name (uppercase recommended)DATABASE_URL
ValueVariable valuepostgres://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/mydb

Application Settings

NODE_ENV=production
PORT=3000
DEBUG=false
LOG_LEVEL=info

API Keys & Secrets

API_KEY=sk_live_xxxxx
JWT_SECRET=your-secret-key
AWS_ACCESS_KEY_ID=AKIAXXXXXXXX
AWS_SECRET_ACCESS_KEY=xxxxxxxx

Service URLs

BASE_URL=https://app.example.com
API_URL=http://senate-api-abc123:8080
FRONTEND_URL=https://www.example.com

Referencing Other Services

For service-to-service communication, use internal hostnames:

# Format: {service-name}-{short-id}
API_URL=http://backend-abc123:8080
DATABASE_HOST=postgres-def456

Find the internal hostname in the service's Domains tab under "Internal Endpoints."

Environment Variables in Compose

For Compose services, environment variables are merged:

  1. Variables defined in docker-compose.yml
  2. Variables set in Senate's Environment tab (override compose)
# docker-compose.yml
services:
  app:
    environment:
      - NODE_ENV=development  # Can be overridden in Senate

Variable Lifecycle

ActionEffect
Add variableAvailable after next deploy
Edit variableTakes effect after redeploy
Delete variableRemoved 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:

  1. Go to service Overview tab
  2. Open the Terminal
  3. Run env or printenv

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

On this page