Environment Variables
Configure your app securely with environment variables. All values are encrypted at rest and injected at runtime.
Setting Variables
- Go to Services > PaaS > Your App > Env Vars
- Click Add Variable
- Enter the key (e.g.,
STRIPE_SECRET_KEY) and value - Click Save — your app restarts automatically with the new value
System Variables (Auto-Set)
These are automatically configured — you cannot modify them:
| Variable | Description |
|---|---|
PORT | The port your app must listen on (required) |
DATABASE_URL | PostgreSQL connection string (if database provisioned) |
Important: Your app must listen on process.env.PORT (Node.js), os.environ['PORT'] (Python), or equivalent. Do not hardcode a port number.
Best Practices
- Never commit secrets to git — use env vars instead
- Use descriptive names:
STRIPE_SECRET_KEYnotKEY1 - Group by service:
REDIS_URL,REDIS_PASSWORD - Values are masked in the dashboard (only last 4 characters shown for security)
Common Variables
| Variable | Example Value | Used For |
|---|---|---|
NODE_ENV | production | Node.js environment |
DATABASE_URL | postgresql://... | PostgreSQL connection |
REDIS_URL | redis://... | Redis connection |
JWT_SECRET | your-secret-key | JWT token signing |
SMTP_HOST | smtp.gmail.com | Email sending |
AWS_ACCESS_KEY_ID | AKIA... | AWS services |
Changing Variables
When you update or add a variable, your app automatically restarts to pick up the new values. This typically takes 5-10 seconds.
Bulk Import (API)
Set multiple variables at once:
bash
curl -X POST https://your-domain.com/api/client/paas/{appId}/env \n -H "Content-Type: application/json" \n -d '{"vars": {"KEY1": "value1", "KEY2": "value2"}}'