HubDocs

Guides

Environment variables

Configure an instance without committing secrets.

View Markdown

Add a secret

For an app you have already deployed:

CLI
hub app my-app env set API_KEY

Paste the value at the hidden prompt. Hub saves it and creates a release to apply the change.

CLI
hub app my-app status

Import a .env file

CLI
hub app my-app env set --file .env

Keep this file out of source control. Saved values are encrypted and are not shown in variable listings.

Configure a frontend build

CLI
hub app my-app env set --build VITE_API_URL=https://api.example.com

Hub rebuilds the app. Frontend build values can appear in the published files, so use them only for public configuration.

Variables belong to one instance. In Compose, pass them to services using ${NAME}; see the database example.

Environment command reference

On this page