S Technologies's Logo

Color

Green
Teal
Indigo
Blue
Purple
Red
Rose

Mode

Light

env

List, set, remove and read the environment variables an application is built and run with.

Environment variables for one application. Each variable has a scope: build reaches the image build, runtime reaches the running application, and both reaches each. Every verb takes --app <app>, or uses the application this directory is linked to. Each also takes --json, --quiet and --help.

CommandWhat it does
env lsList variables, how each is scoped, and which are secret
env pullWrite every variable, with its value, to .env.local
env addSet one variable, reading its value from stdin unless given
env rmRemove one variable
env revealPrint one variable’s value, and nothing else

stechbd env ls

Lists every variable with its scope, whether it is secret, and when it last changed. The panel masks every value on this endpoint, so the output never includes one. Use env pull to write the values to a file, or env reveal to print one.

bash
stechbd env ls [--app <app>]
OptionDescription
--app <app>The application to read. Defaults to the one this directory is linked to. An id, or the slug in the linked project.
bash
# List the variables of the linked application
stechbd env ls

# Same list for a named application, as JSON for a script
stechbd env ls --app <app> --json

stechbd env pull

Writes every variable and its real value to .env.local, or to the file you name. The file is readable only by its owner. The command refuses to replace an existing file unless you pass --force, and it checks this before it asks the panel, because each read is recorded in the audit log.

bash
stechbd env pull [<file>] [--force] [--app <app>]
OptionDescription
<file>Where to write the values. Defaults to .env.local.
--forceReplace the file if it already exists.
--app <app>The application to read. Defaults to the one this directory is linked to. An id, or the slug in the linked project.
bash
# Write .env.local for the linked application
stechbd env pull

# Replace an existing production file
stechbd env pull .env.production --force

# Print the path, the counts and any keys that could not be written. No values.
stechbd env pull --json

stechbd env add

Sets one variable. With no value argument, the value is read from stdin, so a piped value such as cat key.pem stays out of shell history. Interior line breaks are kept, and one trailing newline is removed. An empty stdin is refused, because it is usually a mistake; pass "" as the value to set an empty variable on purpose. Adding a name that already exists is refused unless you pass --force.

bash
stechbd env add <KEY> [<value>] [--scope <build|runtime|both>] [--secret] [--force] [--app <app>]
OptionDescription
<KEY>The variable name: letters, digits and _, not starting with a digit.
<value>The value. Omit it to read the value from stdin. A value typed on the command line is kept in shell history.
--scope <build|runtime|both>Where the variable is used. Defaults to both, or to runtime when --secret is given.
--secretMark the variable as secret. env ls shows it as secret.
--forceReplace the value of a variable that already exists.
--app <app>The application to change. Defaults to the one this directory is linked to. An id, or the slug in the linked project.
bash
# Read a secret from a file, so it stays out of shell history
cat key.pem | stechbd env add SIGNING_KEY --secret

# A plain value for the build and the runtime
stechbd env add API_URL https://api.example.com --scope both

# Replace an existing variable
stechbd env add LOG_LEVEL info --scope runtime --force

stechbd env rm

Removes one variable. The command asks you to confirm first, because a running application that reads the variable loses it at its next deployment. Removing a name that does not exist is refused and changes nothing.

bash
stechbd env rm <KEY> [--yes] [--app <app>]
OptionDescription
<KEY>The variable to remove.
--yesSkip the confirmation prompt.
--app <app>The application to change. Defaults to the one this directory is linked to. An id, or the slug in the linked project.
bash
# Remove a variable after confirming
stechbd env rm LOG_LEVEL

# Remove it without the prompt, for a script
stechbd env rm OLD_TOKEN --yes

stechbd env reveal

Prints the plaintext value of one variable to stdout, and nothing else, so it can be captured into another variable. The panel records this as a read of a single secret, which is a different entry in the audit log from the one env pull leaves.

bash
stechbd env reveal <KEY> [--app <app>]
OptionDescription
<KEY>The variable whose value to print.
--app <app>The application to read. Defaults to the one this directory is linked to. An id, or the slug in the linked project.
# Capture one value into a shell variable
$env:DATABASE_URL = stechbd env reveal DATABASE_URL