Environment variables
Add, edit and scope environment variables for a cloud hosting app, and understand when a change redeploys.
Environment variables hold configuration that should not be committed: database URLs, API keys, feature flags, the port to listen on.
Open the editor
Console → Websites & Apps → your app → Environment Variables.
The table has four columns:
| Column | Meaning |
|---|---|
| Key | Variable name, for example DATABASE_URL |
| Value | The value; hidden until you choose Reveal values |
| Build | Available during the build step |
| Preview | Available to preview deployments |
Use Add variable for a new row, Reveal values / Hide values to inspect, and Save changes to apply. Delete a row with its remove control.
Saving triggers a new deployment with the new values. That is expected: build-time values must be present when the image is produced.
Build-time versus runtime
- Build enabled — the variable is exported while the image is built. Use it for values a build needs, such as a public API base URL that is compiled into a frontend bundle.
- Build disabled — the variable is injected only when the container starts. Prefer this for secrets and for anything that can change without rebuilding.
A frontend framework that inlines NEXT_PUBLIC_*, VITE_* or similar values reads them at build time. If changing such a variable has no effect at runtime, check whether Build is enabled.
Key rules
- Use uppercase names with underscores:
DATABASE_URL,SMTP_HOST. - Do not add a
PORTvariable unless the app needs a specific port; the platform sets it. - Values are stored with the app and visible to members of the organization who can open the app. This is configuration management, not a dedicated secrets vault.
- Nothing is inherited from your laptop or from the repository's
.envfile. Every value the app needs must be present here.
Changing a value safely
- Update the value and save.
- Watch the new deployment finish successfully.
- If the app breaks, restore the previous value and save again.
The old release stays live until the new build succeeds, so a bad value does not take the app down mid-build. It can, however, break the new release after cutover — keep the previous value handy.
Rotating a secret
- Create the new credential at the provider.
- Update the Zoophost variable and save.
- Confirm the app uses the new credential.
- Revoke the old credential.
For credentials that the provider lets you keep valid in parallel, do steps 1–3 before revoking to avoid downtime.
Variables and databases
Managed databases expose a connection string in the database detail page. Paste it into the app's environment as DATABASE_URL (or the name your framework expects). For apps on Zoophost, use the internal connection string: it stays on the private network and is faster than the public endpoint.
See Connect your app to a database.
Next
- environment variables
- env
- secrets
- build time
- runtime
- deploy
Ready to use this
Git-push containers, previews and custom domains, billed monthly in INR.
- 5 websites on the smallest plan
- Free SSL and custom domains

