Configure
Environment variables
Setting them#
- When creating a service — the Environment variables box on the New screen, one
NAME=valueper line. - Afterwards — the service's Environment tab. Add a variable, change one's value, or remove it; each change is saved on its own and leaves the others untouched.
- Many at once — paste a whole
.envfile into the name box on the Environment tab. You see which variables are new and which replace existing values before anything is saved.
PORT=3000
NODE_ENV=production
DATABASE_URL=postgresql://app:s3cret@db.example.com:5432/app?sslmode=require
JWT_SECRET=6b1f0c9e4d2a8f7e3b5c1a9d0e8f7a6b
ALLOWED_ORIGINS=https://app.example.com,https://admin.example.comWho sees what
| Role | Can see | Can change |
|---|---|---|
| Owner, Admin | Names and values | Anything — one at a time, or the whole list as text |
| Developer | Names only | Add, replace or remove one variable at a time — without seeing current values |
| Viewer | Names only | Nothing |
Format rules
- Names: letters, digits and underscores, not starting with a digit — conventionally
UPPER_CASE. - In a pasted file, everything after the first
=is the value —=inside a value is fine (KEY=a=b→a=b). - A pasted file is read like a normal
.env: blank lines and# commentsare skipped, a leadingexportis dropped, and quotes around a value are removed (NAME="a b"→a b). - A value typed into the value box is stored exactly as typed — quotes included. Type
abc, not"abc". - No multi-line values. For a PEM key or a JSON credentials file, store it base64-encoded and decode it in your app.
base64 -w0 service-account.json # Linux
base64 -i service-account.json # macOS
# then in the dashboard: GOOGLE_CREDENTIALS_B64=eyJ0eXBlIjoic2Vy…Applying changes#
Saving does not restart your app
New values reach the app on its next deploy. After saving, press Redeploy now in the confirmation (or Deployments → Redeploy) — it restarts the current image with the new values, without rebuilding.
The exception is anything used while building (next section): those need a new build, so press Settings → Redeploy (or Builds → Trigger build). Your next push would pick them up too, since every push builds and deploys.
You can also edit variables on the service's Settings tab, next to its other settings, and apply everything at once with Redeploy at the top of that page.
Runtime vs build time#
This is the most common surprise. Dashboard variables are given to your app when it runs. Whether they also exist while it is being built depends on the project type:
| Project type | At runtime | During the build |
|---|---|---|
| Web service | Yes | Yes |
| Static site | — (no server) | Yes |
| Dockerfile app | Yes | Those it declares as ARG |
| Container App | Yes — when referenced as ${NAME} | Only through build.args |
That matters for values a frontend bundles into its JavaScript:
| Framework | Build-time variables |
|---|---|
| Vite | VITE_* |
| Create React App | REACT_APP_* |
| Next.js (browser side) | NEXT_PUBLIC_* |
| Angular | environment.prod.ts |
How to provide build-time values
- Set them in the dashboard. A build without a Dockerfile can read every variable; a Dockerfile receives those it declares as
ARG. Because the value is copied into the build, changing one needs Settings → Redeploy, which builds again. - Or commit them in
.env.production. Vite, CRA and Next.js read it automatically during a production build. Suitable because these values are public — they end up in the browser anyway. - Avoid needing one: serve the frontend and API on the same address and call relative paths like
/api/orders(see the Container App example). - Container Apps: pass dashboard variables with
build.args— how.
Build-time values are public
Whatever a frontend is built with is downloadable by every visitor. Never give a frontend build a secret — only URLs, public keys and feature flags.
Variables the platform sets#
None. In particular PORT is not set automatically — add PORT=3000 yourself for Web services (why).
How secrets are protected#
- Values are encrypted in the platform's database.
- Only the account's Admins and Owners can read values back; Developers and Viewers see names only.
- For Container Apps they are written to a file only root can read on the server, and never stored in the app definition — which keeps only the
${NAME}references. - Static site and Web service builds receive them as build secrets: they are not saved in the built image, unless your build copies one into its output (which is exactly what a frontend does with
VITE_*). - Build logs don't print them — unless your own build prints them, and a value passed as a Container App
build.argsis recorded in that image's build history. Never pass a secret as a build argument.
Still: rotate a secret if it was ever committed to Git, even briefly, and prefer separate keys per environment so a leak in staging doesn't expose production.