lua env sets, lists, and deletes the variables your code reads through env. lua env sandbox writes the project’s .env file only; production variables are stored on the server. lua test reads .env; lua chat -e sandbox uploads the .env values with each sandbox version, and sandbox turns read them from the platform. The live agent reads the production variables, and changing them needs no push or deploy.
Verified against lua-cli 3.33.0.
Synopsis
Description
The environment argument issandbox (alias sb) or production (aliases prod, prd, live). staging and its aliases stage and stg are accepted and mean sandbox. An unknown value exits 2 with a suggestion. Using --list, -k, -v, or --delete without an environment also exits 2. With no argument and no flags the command asks which environment to manage and opens a menu to add, update, delete, or view a variable.
For the sandbox the command reads ./.env and, on set or delete, rewrites the whole file as KEY=value lines; comments, blank lines, and quotes are dropped. Keep .env out of version control. For production, --list fetches the stored variables, a set sends the complete variable map with the change applied, and --delete removes one key. Both environments require a project and a credential.
A key must start with a letter or underscore and contain only letters, digits, and underscores; otherwise the command exits 2 with Variable name must start with a letter or underscore and contain only letters, numbers, and underscores. A set prints Created <KEY> or Updated <KEY> and never echoes the value. --list masks values to their first four characters followed by asterisks, and values of four characters or fewer entirely; the interactive menu’s view action is the only way to print a full value. There is no --json output. Deleting a key that does not exist exits 1 with Variable "<KEY>" not found.
Arguments
Options
Examples
Store an API key for local runs, then for the live agent:Output
Output
-k on its own:
Output
Exit codes
See also
- About environments — what sandbox and production share
env— reading variables in code- Call your API — secrets in tools
- Environment variables — the variables that configure the CLI itself
lua production—lua production envlists the same production variables

