Environment 变量 File (.env) Format Guide
Reference 为。env file 格式化 used 为环境变量配置在 applications.
Syntax Rules
Environment files contain KEY=VALUE pairs, one per line. Values may be quoted with single or double quotes to preserve spaces. Double quotes allow variable interpolation; single quotes do not. Comments start with # at the line start. Empty lines are ignored. The format is used by dotenv libraries across languages.
- KEY=VALUE
- One pair per line
- quotes
- Preserve whitespace
- comments
- # at line start
PORT=3000 "hello world" # comment Interpolation and Security
Many dotenv implementations support variable interpolation: ${VAR} or $VAR references. Expansion rules vary between implementations. Secrets in .env files must be excluded from version control via .gitignore. Production secrets should use proper secret management, not .env files. The format is intended for development configuration, not production secrets.
- interpolation
- ${VAR} expansion
- gitignore
- Never commit secrets
- production
- Use secret manager
varies by impl .env in .gitignore not .env