Environment Variables
Environment variables are how you give your app its configuration and secrets — API keys, connection strings, feature flags — without putting them in your code.
Adding a variable
- Open your app and go to the Env Vars tab
- Click Add Variable
- Enter the name (for example
STRIPE_SECRET_KEY) and the value - Save — your app restarts automatically, usually within 5–10 seconds
How they are protected
- Values are encrypted at rest
- Values are masked in the dashboard once saved, so they are not readable over your shoulder
- Variables are private to your app
System variables — set for you, and not editable
Some variables are managed by the platform:
| Variable | What it is |
|---|---|
PORT | The port your app must listen on |
DATABASE_URL | The connection string for your PostgreSQL database |
You cannot change or delete these, and that is deliberate. If you try, you will see "Cannot modify system variable". This protects your app from losing its database connection — it is not a fault.
DATABASE_URL is re-applied on every deploy. If you overwrite it, your change will be replaced the next time you deploy.
Using an external database instead
If you want to connect to a database you host elsewhere, do not try to overwrite DATABASE_URL. Add your own variable under a different name — for example EXTERNAL_DATABASE_URL — and read that in your code.
Your app must read the port from the environment
// Node.js
const port = process.env.PORT || 3000;
app.listen(port, '0.0.0.0');# Python
port = int(os.environ.get('PORT', 5000))
app.run(host='0.0.0.0', port=port)Bind to 0.0.0.0, never localhost — an app listening on localhost cannot be reached from outside its container.
Good practice
- Never commit secrets to git — use variables instead
- Use clear names:
STRIPE_SECRET_KEY, notKEY1 - Names are case-sensitive:
DATABASE_URLis not the same asdatabase_url - Watch for trailing spaces in pasted values
Setting several at once
You can set multiple variables in one request from your terminal:
curl -X POST https://<your panel address>/api/client/paas/{appId}/env \
-H "Content-Type: application/json" \
-d '{"vars": {"KEY1": "value1", "KEY2": "value2"}}'If a variable does not seem to apply
- Confirm it is listed in the Env Vars tab
- Check the spelling and capitalisation
- Your app restarts automatically after a change — check the Logs tab to confirm it restarted cleanly