> ## Documentation Index
> Fetch the complete documentation index at: https://aeros-c1d071c8.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# .env editor

> Edit a project's environment variables from the panel and write them to <work_dir>/.env.

Every project unit loads `<work_dir>/.env` through `EnvironmentFile=-<work_dir>/.env`. The `-` prefix means the service still starts if the file does not exist. The panel edits this file for you.

## Edit variables

**1. Open the editor**

Select a project and press **.env** (**Edit .env**) in the toolbar. The terminal switches to `EDIT_ENV` mode and loads the saved contents.

**2. Edit and save**

Write one `KEY=value` per line, the format `systemd` expects for `EnvironmentFile=`, then press **SAVE\_ENV**. **CANCEL** discards your edits.

```bash .env theme={null}
NODE_ENV=production
PORT=3001
DISCORD_TOKEN=replace-me
```

**3. Restart the service**

`systemd` reads `EnvironmentFile=` only when the service starts. Press **Restart** or run a deploy to apply the new values.

## How it is stored

Saving runs [`POST /api/projects/:id/env`](https://aeros-c1d071c8.mintlify.site/api/endpoints#environment-file), which:

1. Resolves the working directory (`work_dir`, or `/opt/<service_name>`) through `validateWorkDir`. System directories and the filesystem root are rejected.
2. Saves the text in the `env_vars` column of the `projects` table in `aeros.db`.
3. If the working directory exists, writes it to `<work_dir>/.env` with mode `0600`.

Responses from both the read and write endpoints carry `Cache-Control: no-store`, so the browser does not cache your secrets. Values are never written to the panel's logs.

> [!WARNING]
>
> The editor loads what the panel saved last, from SQLite. It does not read `<work_dir>/.env` from disk. If you edit the file by hand over SSH, the editor will not show those changes, and the next save from the panel overwrites them.

## Protect the copies

The same values exist in two places, so protect both:

* `<work_dir>/.env`, written as `0600` and owned by root. If the unit sets `User=`, `systemd` still reads the file as root before dropping privileges, so the service user does not need read access to it.
* `aeros.db`, which the installer sets to `0600`. Include it in a [backup job](https://aeros-c1d071c8.mintlify.site/backups.md) and treat those archives as secrets too.

> [!TIP]
>
> Add `.env` to your app's `.gitignore`. An untracked `.env` is left alone by `git pull` and by the `git reset --hard` that [rollback](https://aeros-c1d071c8.mintlify.site/deploy-and-rollback.md#rollback) runs. A tracked one would be overwritten.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.