# Variables and secrets

> Add environment variables one by one or from a .env file, protect a secret, reference another variable, export.

Source: https://docs.fransys.cloud/en/projets/variables-et-secrets/ Checked against the console on 2026-10-23.

## Add a variable

In the service panel, environment variables section, **Single variable** mode: a name, a value, then **Add**. The variable applies at the project's next deployment.

Three options per variable:
- **Expose to connected services**: services linked to this one receive the variable;
- **Protect the value**: the value is encrypted and can't be read afterwards, not even by you. Keep a copy somewhere safe;
- **Allow ${VAR} references**: the value can reference another variable, for example `${APP_URL}/api`. It's replaced at deployment.

## Import a .env file

**Multiple variables (.env)** mode: paste the file's content, one variable per line (`KEY=value`). `#` comments, quoted values and blank lines are accepted. Names are converted to upper case.

The **Preview before import** shows the variables it recognised, the ones already there, and the lines it skipped, with the reason (no `=` sign, unclosed quote…). For each name that already exists, choose:
- keep the current value;
- replace the current value;
- import under another name (`_2` suffix).

The options (exposed, protected, references) apply to every imported variable. Keep the panel open until the import is done.

## Export

**Export variables** gives you the content in `.env` format, to copy or download. Protected values can't be read: they appear as comments (`# KEY=`), to fill in by hand. Variables received from connected services aren't included.

## Received variables

Variables that come from a connected service (a database, for example) are marked **received from a connected service**. You don't edit them here, but you can rename them. See [Linking services](https://docs.fransys.cloud/en/projets/relier-des-services/).

## Build-time variables

Variables read while the image is being built (for example `VITE_…`) aren't passed on by Fransys CI yet. Keep them in your code, or read them when the application starts.
