Environment Variables
Detected variables, secrets, generations and when changes take effect.
Each app has its own set of environment variables. Manage them on the Environment tab of the app or with lly env.
Step by step: Set environment variables.
Detection
During analysis, LILY proposes the variables each app reads:
- Names read in code:
process.env.API_KEY,os.environ["API_KEY"],os.getenv,env::var,getenv. - Uppercase
NAME=valuelines in.envfiles.
Each proposed variable shows the file it was found in. Values from .env files are prefilled. Fill in the remaining values during configuration. Empty variables do not block the deploy and are passed to the app unset.
A .env value that points to another app in the same repository, for example API_URL=http://api:8080, is linked to that app. The variable receives the address of that app, and LILY proposes a connection between both apps. A value you enter overrides the linked value.
Secrets
Variables are treated as secrets if their name contains SECRET, PASSWORD, TOKEN, KEY, CREDENTIAL or PRIVATE, or if they are database URLs. Secret values are not shown after saving, in neither the console nor the CLI, and are not prefilled from files.
Secrets of an existing app can be kept or deleted, but not changed. To change a secret, delete it and add it again.
Generations
Each saved change creates a new generation, for example gen 5. A running app keeps the generation it was started with. New values take effect with the next deploy.
The Environment tab shows whether the saved generation is live or waits for the next deploy. After saving, the console offers Redeploy. In the CLI, run lly redeploy after lly env set.
Editing
The Environment tab offers a table and Bulk edit, which accepts NAME=value lines in .env format. Changes are saved together. If one variable is invalid, nothing is saved and all errors are listed.
| Rule | Limit |
|---|---|
| Name | Starts with a letter or _, followed by letters, digits or _. Up to 128 characters. |
| Value | Up to 4096 characters |
LILY does not set variables automatically. PORT is not set; the port is defined by the service ports of the app.