Multi-line values
Wrap multi-line values in double quotes:
PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----"
Note: To use legacy \n replacement, set DOTENV_LINEBREAK_MODE=legacy.
Command Substitution
Use $(command) to include command output:
DATABASE_URL="postgres://$(whoami)@localhost/my_database"
Variable Substitution
Reference other variables using ${VAR} or $VAR:
DATABASE_URL="postgres://${USER}@localhost/my_database"
If a value contains a $ that should not be treated as a variable, wrap it in single quotes: PASSWORD='pas$word'.
Use # for comments:
# This is a comment
SECRET_KEY=VALUE # comment