env

Read and change the environment variables of an app.

lly env [SLUG|ID] [list]
lly env [SLUG|ID] get <NAME>
lly env [SLUG|ID] set <KEY=VALUE>...
lly env [SLUG|ID] unset <NAME>...
lly env [SLUG|ID] pull [--out <FILE>]
lly env [SLUG|ID] push <FILE> [--prune]
lly env [SLUG|ID] edit

Changes take effect with the next deploy of the app. Run redeploy to apply them:

lly env copperfox set LOG_LEVEL=debug FEATURE_X=on
lly redeploy copperfox

See Environment Variables for detection, secrets and generations.

list

  Environment Variables
  Key        Value
  LOG_LEVEL  debug
  API_TOKEN  ••••••  · src/api.ts

Lists all variables. Secret values are masked. Detected variables show the file they were found in.

get

lly env copperfox get LOG_LEVEL

Prints the value only. Secret values cannot be read.

set

lly env copperfox set KEY=VALUE [KEY=VALUE ...]

Adds or changes variables. The value starts after the first =. New variables are not secret. An existing secret cannot be changed: unset it, then set it again.

unset

lly env copperfox unset FEATURE_X

Removes variables after confirmation.

pull

lly env copperfox pull
lly env copperfox pull --out .env.local

Writes the variables to a .env file readable only by your user. Default file: .env.lily. Secrets are written as comments without a value.

push

lly env copperfox push .env.production
lly env copperfox push .env.production --prune

Reads a .env file into the variables. Supports KEY=VALUE, export KEY=VALUE, quoted values and comments. --prune removes variables that are not in the file. Secrets are not changed; secrets in the file are skipped with a warning.

edit

Opens the variables in $VISUAL or $EDITOR. Change or add lines, or delete a line to remove the variable. Secrets are shown as comments and kept.

Options

OptionDescription
--out <FILE>pull: target file. Default: .env.lily.
--prunepush: remove variables that are not in the file

Exit codes

CodeCause
2get on a secret, set on an existing secret, request larger than 64 KB, or edit without $EDITOR
4Variable not found

JSON output

list: {"appId", "variables": [{"name", "secret", "value", "origin", "foundIn"}], "generation", "deployedGeneration", "applied"}. get: {"name", "value"}. pull: {"path", "variables"}. set, unset, push, edit: {"app", "generation", "deployed_generation", "applied", "changed"}. applied shows whether the running app uses the new generation.

See also

On this page