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.
Automation
Section titled “Automation”Set CI=1 when a command runs in a non-interactive environment:
CI=1 layer init demo-api --name demo-apiWhen 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.
Output
Section titled “Output”Set NO_COLOR=1 to disable ANSI color in CLI output:
NO_COLOR=1 layer deploy --env productionCloudflare Direct Workflows
Section titled “Cloudflare Direct Workflows”These variables provide defaults for direct Cloudflare workflows:
| Variable | Used by | Notes |
|---|---|---|
CLOUDFLARE_ACCOUNT_ID | layer login, layer deploy, layer destroy, layer resource delete, layer scan, layer drift, layer reconcile | Supplies the Cloudflare account id. A command --account-id value takes precedence. |
CLOUDFLARE_ZONE_ID | layer deploy, layer destroy, layer scan, layer drift, layer reconcile | Supplies the Cloudflare zone id for route and custom domain resources. A command --zone-id value takes precedence. |
CLOUDFLARE_ACCOUNT_API_TOKEN | Direct Cloudflare credential resolution | Supplies 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.
Wrangler
Section titled “Wrangler”Layeron passes the current environment to Wrangler when it invokes Wrangler for direct deployment steps.
| Variable | Notes |
|---|---|
CLOUDFLARE_API_TOKEN | Passed through to Wrangler. When this variable is absent, Layeron supplies the Cloudflare token resolved from CLOUDFLARE_ACCOUNT_API_TOKEN or saved credentials. |
WRANGLER_SEND_METRICS | Passed through to Wrangler. Layeron sets it to false by default for Wrangler subprocesses. |
Secret Values
Section titled “Secret Values”layer secret set can read a secret value from an environment
variable named by --value-env:
STRIPE_WEBHOOK_SECRET=whsec_... \ layer secret set STRIPE_WEBHOOK_SECRET --value-env STRIPE_WEBHOOK_SECRETThe command exits if the named environment variable is empty.