Docs · Configure
Environment variables and secrets
Set variables on an environment’s Variables tab. Every value is encrypted when it is saved and never shown again, so there is no separate kind for secrets: every variable is treated as one. Saving or removing one restarts the app with the change.
Setting variables
- When you create an app: open Environment variables, then add them One by one or Paste .env. The paste box takes
NAME=valueorNAME: value, one a line, and skips comments andexport. The app’s first release starts with them. - Afterwards: on the environment’s Variables tab, enter a name and value and choose Add. Setting a name that exists replaces its value.
# comments are skipped
DATABASE_URL=postgres://user:pass@db.example.com:5432/app
export APP_KEY=base64:…
MAIL_FROM: hello@example.comEach environment has its own variables: production and staging do not share them. Static sites have none, since nothing runs.
When a change takes effect
At once. Saving or removing a variable restarts the running app with the new set; nothing is rebuilt. Every deploy starts with the current values.
Names and values
- Names are letters, digits and
_, and do not start with a digit, likeDATABASE_URL. - A value cannot contain a newline, a carriage return or a NUL. To pass a multi-line value such as a PEM key, encode it (as base64, say) and decode it in your app.
- One invalid variable refuses the whole change, so nothing is half-saved.
How they are stored
Each environment has its own encryption key, and each value is sealed with AES-256-GCM as it is saved. The dashboard only ever lists names. To see a value again, look where you keep the original: homeport cannot show it to you either.
Variables homeport sets
| Name | Value |
|---|---|
PORT | The port your app must listen on. Assigned per app, so never hard-code one. |
HOST | 0.0.0.0: the address to listen on. |
STATE_DIR | A writable folder that is kept from one release to the next. |
NODE_ENV | production |
PORT, HOST, HOSTNAME and PATH are set by homeport and cannot be overridden. Values you set for system names such as HOME, USER, SHELL, LANG or TERM are not passed to your app.
In homeport.yaml’s run, only $PORT and $HOST can be used. Read every other variable from the environment in your code.