# Environment variables

## Environments

Every variable belongs to one or more environments:

- **Production**: production deployments.
- **Preview**: branch and pull-request deployments.
- **Development**: what `hostedge env pull` writes to `.env.local` for local work.

## Adding variables

Add them one by one or paste a whole `.env` file: quotes, `export` prefixes, comments, escapes and multi-line values are understood, and any line that can't be read is pointed out by number.

## How they're stored

Values are encrypted with AES-256-GCM before they reach the database, bound to the project, name and environment so a value can't be moved to another variable. The list shows names only. Revealing a value is a deliberate click, available to Developers and above, and recorded in the audit log.

## Using them

Variables are available to your build command and, for Workers projects, at runtime as `env.NAME`. Static sites only see them at build time.

## Changes need a redeploy

Deployments keep the values they were built with. After a change, HostEdge offers to redeploy production with the new values.

## Limits

Up to 63 variables per project and 5 KB per value (platform limits). Names starting with `HOSTEDGE_` or `CF_` are reserved.

Every deployment also receives `HOSTEDGE_PROJECT_ID`, `HOSTEDGE_MAIL_URL` and `HOSTEDGE_MAIL_SECRET` (used by [Authentication](https://hostedge.app/docs/authentication) to send sign-in emails) and `HOSTEDGE_CRON_SECRET` (used by [Cron jobs](https://hostedge.app/docs/cron-jobs)). Treat them like any secret.
