App Platform · Environment variables
Docs / App Platform

Environment variables

Set environment variables and secrets on a project from the redeploy screen, then redeploy to apply them.

Apps read configuration and secrets from environment variables. On App Platform, env vars live on a project's redeploy screen — you set them, then redeploy so the new container boots with them.

How it works

Open the redeploy screen to see the existing environment, add or change values, and click redeploy. The change takes effect on the next rollout, with no downtime.

  1. 1
    Open Configure and expand Configuration
    From the project page, click Configure. The Configuration section is expanded by default, showing Custom Install Commands, Custom Build Commands, Custom Run Command, and Environment Variables.
  2. 2
    Add an environment variable
    Type a KEY and a value into the two fields and click the + button. Existing variables are listed as inline-editable KEY=value rows below, each with its own trash-icon delete button.
  3. 3
    Adjust anything else while you're here
    The same screen also has Port (leave at 0 for auto-detect), Root Directory (default /), and a Use PM2 for process management checkbox that reveals a PM2 process name field if you check it.
  4. 4
    Click Deploy
    The footer's Deploy button (rocket icon) redeploys with everything you've changed — env vars, commands, port, and Dockerfile edits all apply together in the same rollout.
Redeploy screen with custom install/build/run commands and environment variables
Set custom install, build, and run commands alongside KEY/VALUE environment variables, all in the same redeploy screen.

Keeping env vars out of your repo and in the redeploy screen means you can rotate a key or point at a different database without touching code or triggering a new build from source — just redeploy the existing image with the updated config.

Important
Never commit secrets to your repo. Set them as environment variables here instead, and treat them like passwords — see Account & security.
Note
Env var changes only take effect after a redeploy — saving the config alone does not restart the running container.