Skip to content

Environment variables

Environment variables are useful for automation, CI jobs, and local shells that run the same Layeron command repeatedly.

Command options take precedence over environment variables when both are provided.

Set CI=1 when a command runs in a non-interactive environment:

Terminal window
CI=1 layer init demo-api --name demo-api

When CI=1 is set, the CLI skips interactive input. A prompt with a default value uses that default. A required prompt without a default exits with an error that names the option to pass.

For destructive confirmation prompts, the default answer is no. Use the documented command option for the action, such as --auto-approve on layer destroy, when automation should approve the operation.

Set NO_COLOR=1 to disable ANSI color in CLI output:

Terminal window
NO_COLOR=1 layer deploy --env production

These variables provide defaults for direct Cloudflare workflows:

VariableUsed byNotes
CLOUDFLARE_ACCOUNT_IDlayer login, layer deploy, layer destroy, layer resource delete, layer scan, layer drift, layer reconcileSupplies the Cloudflare account id. A command --account-id value takes precedence.
CLOUDFLARE_ZONE_IDlayer deploy, layer destroy, layer scan, layer drift, layer reconcileSupplies the Cloudflare zone id for route and custom domain resources. A command --zone-id value takes precedence.
CLOUDFLARE_ACCOUNT_API_TOKENDirect Cloudflare credential resolutionSupplies the Cloudflare account API token used by Layeron direct workflows. CLOUDFLARE_ACCOUNT_ID is required when this variable is set.

Saved credentials from layer login are used as the fallback after environment credential resolution.

Layeron passes the current environment to Wrangler when it invokes Wrangler for direct deployment steps.

VariableNotes
CLOUDFLARE_API_TOKENPassed through to Wrangler. When this variable is absent, Layeron supplies the Cloudflare token resolved from CLOUDFLARE_ACCOUNT_API_TOKEN or saved credentials.
WRANGLER_SEND_METRICSPassed through to Wrangler. Layeron sets it to false by default for Wrangler subprocesses.

layer secret set can read a secret value from an environment variable named by --value-env:

Terminal window
STRIPE_WEBHOOK_SECRET=whsec_... \
layer secret set STRIPE_WEBHOOK_SECRET --value-env STRIPE_WEBHOOK_SECRET

The command exits if the named environment variable is empty.