rob-revisited/docs/ide/dotenv.md

32 lines
1.7 KiB
Markdown

# .env files
`.env`, `.env.local`, `.env.<env>`, `.env.<env>.local`, `.env.dist`, Laravel's `.env.example` and Compose `*.env` files open in the
**.env editor**: **Code**, **Table**, **Split**, **Variables** and, for Symfony, **Vault** (the buttons at the bottom right).
## Code
Colours for names, values, comments, `${REFS}` and quotes; completion of the variables Symfony and Laravel know, of `${REFS}` and of
DSN examples (`DATABASE_URL=`, `MAILER_DSN=`…); markers for invalid names, unclosed quotes, a name defined twice, a secret in a file
git tracks.
## Table
The file's variables with their effective value for dev / test / prod. Rename, change, comment, add, delete, **Move to** another file,
**Copy to** an environment's file. Values are edited by kind: booleans, numbers, multi-line text, and DSNs with a **DSN builder**
(driver, user, password, host, port, database, options). A value another file overrides is struck through with the file that wins.
Each edit rewrites only that variable's lines.
## Variables
The folder's files merged in the order the application loads them (Symfony: `.env`, `.env.local`, `.env.<env>`, `.env.<env>.local`;
Laravel: `.env.<env>` or `.env`), with where each value comes from. References are resolved.
## Secrets
Names with PASSWORD, SECRET, TOKEN, KEY… are masked (the eye shows them). A real secret in a tracked file is a warning with **Move
them to .env.local** in one click (and `.gitignore` completed).
## Vault (Symfony)
The secrets of `config/secrets/<env>/`: reveal on demand, add / change (the value goes to the command's standard input, never on a
command line), delete, generate or rotate the keys. A decrypt key tracked by git is a danger banner.