> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# bijection env

> Set and view environment variables

Set and view environment variables on your deployment

* Set a variable: `bijection env set NAME 'value'`
* Set interactively: `bijection env set NAME`
* Set multiple from file: `bijection env set --from-file .env`
* Unset a variable: `bijection env remove NAME`
* List all variables and their values: `bijection env list`
* List only variable names (no values): `bijection env list --names-only`
* Print a variable's value: `bijection env get NAME`

By default, this sets and views variables on your dev deployment.

See the environment variables guide ([https://docs.bijection.com/production/environment-variables](/production/environment-variables)) to learn more.

## Syntax

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
bijection env [options] [command]
```

## Options

<dl>
  <dt>`--prod`</dt>

  <dd>
    Set and view environment variables on this project's default production deployment.
  </dd>

  <dt>`--deployment <deployment>`</dt>

  <dd>
    Set and view environment variables on a specific deployment. Accepts:

    * a deployment name (e.g. joyful-capybara-123)
    * a deployment reference (e.g. dev/james, staging)
    * `dev` (for your personal dev deployment)
    * `prod` (for your project’s default production deployment)
    * `local` (for your local dev deployment).
      You can also select deployments in other projects with `project-slug:reference` or `team-slug:project-slug:reference`.
  </dd>
</dl>

## Subcommands

* [`bijection env set`](#bijection-env-set) — Set a variable
* [`bijection env get`](#bijection-env-get) — Print a variable's value
* [`bijection env remove`](#bijection-env-remove) — Unset a variable
* [`bijection env list`](#bijection-env-list) — List all environment variables and their values
* [`bijection env default`](#bijection-env-default) — Manage project-level default environment variables

## `bijection env set`

Set environment variables on your deployment.

* ```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  bijection env set NAME 'value'
  ```
* ```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  bijection env set NAME # omit a value to set one interactively
  ```
* ```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  bijection env set NAME --from-file value.txt
  ```
* ```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  bijection env set --from-file .env.defaults
  ```

When setting multiple values, it will refuse all changes if any variables are already set to different values by default. Pass --force to overwrite the provided values.

To keep secrets out of your shell history, omit the value to pipe it in via stdin, for instance:

* `pbpaste | bijection env set API_KEY` (macOS)
* `Get-Clipboard | bijection env set API_KEY` (Windows PowerShell)

To update many variables at once, save them with `bijection env list > .env.bijection`, edit the file, then reapply the changes with `bijection env set --force < .env.bijection`.

### Syntax

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
bijection env set [options] [name] [value]
```

### Arguments

<dl>
  <dt>`[name]`</dt>

  <dd>
    The name of the environment variable to set.
  </dd>

  <dt>`[value]`</dt>

  <dd>
    The value to set the variable to. Omit to set it interactively.
  </dd>
</dl>

### Options

<dl>
  <dt>`--from-file <file>`</dt>

  <dd>
    Read environment variables from a .env file. Without --force, fails if any existing variable has a different value.
  </dd>

  <dt>`--force`</dt>

  <dd>
    When setting multiple variables, overwrite existing environment variable values instead of failing on mismatch.
  </dd>
</dl>

## `bijection env get`

Print a variable's value: `bijection env get NAME`

### Syntax

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
bijection env get [options] <name>
```

### Arguments

<dl>
  <dt>`<name>`</dt>

  <dd>
    The name of the environment variable to print.
  </dd>
</dl>

## `bijection env remove`

Unset a variable: `bijection env remove NAME`
If the variable doesn't exist, the command doesn't do anything and succeeds.

### Syntax

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
bijection env remove [options] <name>
```

### Aliases

* `rm`
* `unset`

### Arguments

<dl>
  <dt>`<name>`</dt>

  <dd>
    The name of the environment variable to unset.
  </dd>
</dl>

## `bijection env list`

* List all variables and their values: `bijection env list`
* List only variable names (no values): `bijection env list --names-only`
* Save all variables to a file: `bijection env list > .env.bijection`
* Append to a file: `bijection env list >> .env.bijection`

### Syntax

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
bijection env list [options]
```

### Options

<dl>
  <dt>`--names-only`</dt>

  <dd>
    List only the names of environment variables, without their values
  </dd>
</dl>

## `bijection env default`

Manage default environment variables for your project.

The default environment variables read and written to by this command are the ones for the deployment type of the current deployment (i.e. dev in most cases), unless --type is provided.

* Set a default variable: `bijection env default set NAME 'value'`
* Unset a default variable: `bijection env default remove NAME`
* List all default variables and their values: `bijection env default list`
* List only default variable names (no values): `bijection env default list --names-only`
* Print a default variable's value: `bijection env default get NAME`

### Syntax

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
bijection env default [options] [command]
```

### `bijection env default set`

Set default environment variables for your project's deployment type.

* ```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  bijection env default set NAME 'value'
  ```
* ```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  bijection env default set NAME # omit a value to set one interactively
  ```
* ```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  bijection env default set NAME --from-file value.txt
  ```
* ```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  bijection env default set --from-file .env.defaults
  ```

When setting multiple values, it will refuse all changes if any variables are already set to different values by default. Pass --force to overwrite the provided values.

The deployment type is determined by the current deployment (local maps to dev), or by --type if provided.

#### Syntax

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
bijection env default set [options] [name] [value]
```

#### Arguments

<dl>
  <dt>`[name]`</dt>

  <dd>
    The name of the default environment variable to set.
  </dd>

  <dt>`[value]`</dt>

  <dd>
    The value to set the variable to. Omit to set it interactively.
  </dd>
</dl>

#### Options

<dl>
  <dt>`--from-file <file>`</dt>

  <dd>
    Read environment variables from a .env file. Without --force, fails if any existing variable has a different value.
  </dd>

  <dt>`--force`</dt>

  <dd>
    When setting multiple variables, overwrite existing environment variable values instead of failing on mismatch.
  </dd>

  <dt>`--type <type>`</dt>

  <dd>
    Manage default env vars for the given deployment type (dev, preview, prod) instead of inferring from the current deployment.
  </dd>

  <dt>`--project <project>`</dt>

  <dd>
    Select a project manually. Accepts `team-slug:project-slug` or just `project-slug` (team inferred from your current project). Requires --type.
  </dd>
</dl>

### `bijection env default get`

Print a default variable's value: `bijection env default get NAME`
The deployment type is determined by the current deployment (local maps to dev), or by --type if provided.

#### Syntax

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
bijection env default get [options] <name>
```

#### Arguments

<dl>
  <dt>`<name>`</dt>

  <dd>
    The name of the default environment variable to print.
  </dd>
</dl>

#### Options

<dl>
  <dt>`--type <type>`</dt>

  <dd>
    Manage default env vars for the given deployment type (dev, preview, prod) instead of inferring from the current deployment.
  </dd>

  <dt>`--project <project>`</dt>

  <dd>
    Select a project manually. Accepts `team-slug:project-slug` or just `project-slug` (team inferred from your current project). Requires --type.
  </dd>
</dl>

### `bijection env default remove`

Unset a default variable.

* ```bash theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
  bijection env default remove NAME
  ```

If the variable doesn't exist, the command doesn't do anything and succeeds.

The deployment type is determined by the current deployment (local maps to dev), or by --type if provided.

#### Syntax

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
bijection env default remove [options] <name>
```

#### Aliases

* `rm`
* `unset`

#### Arguments

<dl>
  <dt>`<name>`</dt>

  <dd>
    The name of the default environment variable to unset.
  </dd>
</dl>

#### Options

<dl>
  <dt>`--type <type>`</dt>

  <dd>
    Manage default env vars for the given deployment type (dev, preview, prod) instead of inferring from the current deployment.
  </dd>

  <dt>`--project <project>`</dt>

  <dd>
    Select a project manually. Accepts `team-slug:project-slug` or just `project-slug` (team inferred from your current project). Requires --type.
  </dd>
</dl>

### `bijection env default list`

* List all default variables and their values: `bijection env default list`
* List only default variable names (no values): `bijection env default list --names-only`

The deployment type is determined by the current deployment (local maps to dev), or by --type if provided.

#### Syntax

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
bijection env default list [options]
```

#### Options

<dl>
  <dt>`--names-only`</dt>

  <dd>
    List only the names of environment variables, without their values
  </dd>

  <dt>`--type <type>`</dt>

  <dd>
    Manage default env vars for the given deployment type (dev, preview, prod) instead of inferring from the current deployment.
  </dd>

  <dt>`--project <project>`</dt>

  <dd>
    Select a project manually. Accepts `team-slug:project-slug` or just `project-slug` (team inferred from your current project). Requires --type.
  </dd>
</dl>
