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

# environment-variable update

> Update the value and/or secret status of an environment variable

Updates the value and/or secret status of an existing environment variable in an Alpic environment.

## Usage

```bash theme={null}
alpic environment-variable update
```

Prompts to select the variable and enter the new value interactively.

## Extended Usage

**Update a variable's value:**

```bash theme={null}
alpic environment-variable update --key DATABASE_URL --value postgres://prod/db
```

**Update a variable in a specific environment:**

```bash theme={null}
alpic environment-variable update --key PORT --value 8080 --environment-id <environmentId>
```

**Change a variable's secret status:**

```bash theme={null}
alpic environment-variable update --key PORT --no-secret
```

## Options

| Flag                | Description                                                                                    |
| ------------------- | ---------------------------------------------------------------------------------------------- |
| `--environment-id`  | The ID of the environment (optional — read from local config if omitted)                       |
| `--key`             | The key of the environment variable to update                                                  |
| `--value`           | The new value (omit to keep the current value)                                                 |
| `--secret`          | Mark as secret. Use `--no-secret` to make it visible                                           |
| `--non-interactive` | Disable interactive prompts. Requires `--key` and one of `--value` or `--secret`/`--no-secret` |

<Tip>
  When running from a directory linked to an Alpic project (via `alpic deploy`), `--environment-id` is optional — the
  CLI reads it from the local `.alpic` config file.
</Tip>
