# Environments and secrets (/docs/environments)



Each project has environments (usually `development`, `preview` and `production`). A build gets the variables of its profile's environment.

## Visibility [#visibility]

| Visibility    | Stored    | Who can read it                                                                |
| ------------- | --------- | ------------------------------------------------------------------------------ |
| **Plain**     | As text   | Everyone with access. Can be embedded in the app, like `EXPO_PUBLIC_*` values. |
| **Sensitive** | Encrypted | Masked in the dashboard; members can reveal it (the reveal is audit logged).   |
| **Secret**    | Encrypted | Write-only: no API returns it after saving. Only builds receive it.            |

Values starting with `EXPO_PUBLIC_` are inlined into the app bundle, so they can't be secret.

## In a build [#in-a-build]

The runner exports every variable as an environment variable for all build steps and writes them to `.env` for Expo. Sensitive and secret values are replaced by `***` in every log line, and the build's audit log entry lists which secret names it read.

## Encryption [#encryption]

Sensitive and secret values use envelope encryption: AES-256-GCM with a per-organization data key, which is itself encrypted by a master key held in a key management service. Each ciphertext is bound to its organization, environment and key, so it can't be copied to another variable.

## Revisions and promotion [#revisions-and-promotion]

Every change creates a revision with the full set of variables, so you can restore any earlier revision. **Promote** copies variables from one environment to another (for example `preview` to `production`), showing what would be added or changed first. You can also import and export `.env` files (secret values are skipped on export).

## From the command line [#from-the-command-line]

```sh
liftbay env import .env.production .env.preview   # each file into the environment it's named for
liftbay env import .env.staging -e preview         # any file into a chosen environment
liftbay env set API_REGION=us -e production
liftbay env list -e production
```

Each key's visibility comes from its name: `EXPO_PUBLIC_*` is plain, names like `*_TOKEN`, `*_SECRET`, `*_PASSWORD` or `*_KEY` are secret, and everything else is sensitive. Pass `--visibility` to choose one for every key in an import. All commands are in the [CLI reference](/docs/cli#environment-variables).

## Coming from EAS [#coming-from-eas]

`liftbay init` reads your `eas.json`:

* Every build profile becomes a Liftbay build profile with the same name, channel and distribution.
* Each profile's `env`, with `extends` resolved, goes into an environment of the same name.
* Profiles that only exist to be extended, like a shared `base`, pass their `env` on to the profiles that extend them.

Run `liftbay env import eas.json` any time to import the `env` again (it overwrites).

EAS environment variables stored on expo.dev aren't in `eas.json`. Pull them, then import them:

```sh
npx eas env:pull --environment production --path .env.eas.production
liftbay env import .env.eas.production -e production
```
