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

Sensitive values such as passwords and API keys. Variables with secret-like names (containing PASSWORD, TOKEN, SECRET, _KEY, etc.) are masked in the dashboard and revealed only when you click the eye icon.

Adding Variables During Deployment

When you deploy from GitHub, SnapDeploy scans your repository and shows an Environment Variables Detected screen so you can set values before the first launch.

  1. 1 Click + Deploy in the top bar, then choose Deploy from GitHub and select your repository and branch.
  2. 2 On the Environment Variables Detected screen, SnapDeploy lists variables it found in your Dockerfile, .env.example, and framework config. Ones your app needs are tagged Required; likely secrets show a Secret badge and are masked as you type.
  3. 3 Enter a value for each variable. To add one we did not detect, click + Add Variable and provide the key and value.
  4. 4 Click Deploy. Your container launches with these variables baked in.

Editing Variables After Deployment

You can add, change, or delete environment variables on a live container at any time — no need to delete and redeploy.

  1. 1 On the Containers page, click the gear icon on your container to open Container Settings.
  2. 2 Scroll to the Environment Variables section. Your current variables are listed; secret-named ones are masked with an reveal toggle, and PORT is managed by SnapDeploy and locked.
  3. 3 Make your changes: click + Add for a new variable, edit a value inline, or click the icon to delete one.
  4. 4 Click Save Environment Variables.

How your changes apply

Environment variables are read when your app starts, so a restart is required for new values to take effect — SnapDeploy handles this for you automatically:

  • If your container is running, SnapDeploy performs a zero-downtime rolling restart (about 2–3 minutes). A progress bar appears on the container card, and the new values take effect once it completes.
  • If your container is sleeping or stopped, the changes are saved and applied automatically the next time it wakes or starts.

Variables provided by an attached add-on (for example DATABASE_URL from a database) are managed by SnapDeploy and take precedence over a value you set by hand.

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