Перейти в хранилище документации
Обратиться в техническую поддержку![]()
When a new developer joins the team, they don't need to ask for a list of necessary environment variables. They simply copy .env.dist.local to .env.local and fill in their unique settings. 2. Prevents Accidental Secret Exposure
Then, create a .env.local file to override the default values for your local environment:
The .env.dist.local file is a file that serves as a guide for what environment variables a project needs to run.
This file is committed to Git. It uses fake data, documentation comments, and placeholders. .env.dist.local
: Use this file to document variables that are unique to a developer's machine but necessary for the app to run (e.g., LOCAL_DB_PORT=5432 ).
By placing a variable in .env.dist.local , you ensure that every developer who clones the repo has a functional local setup without needing to manually copy-paste common non-sensitive configurations. Best Practices & Security
: A shared template committed to the repository. It contains all required keys (e.g., DATABASE_URL , API_KEY ) but with placeholder or "safe" default values. When a new developer joins the team, they
In modern development frameworks, files are loaded in a specific order of priority (higher items override lower ones): : Real local values (Never committed). .env : The base configuration.
: When setting up a new development environment, developers can copy the .env.dist.local file to create a .env file. They then populate the .env file with their specific environment variable values.
The application loads .env.local , ignoring the default placeholders in .env.dist.local . Commit: Git ignores the local file, keeping secrets safe. Prevents Accidental Secret Exposure Then, create a
For a Node.js project, you can use a simple initialization script in your package.json :
A: Yes, you should only commit a base .env file that contains no real secrets . It should act as a template with safe, default values. Never commit a .env.local file or any other file that contains sensitive, real-world credentials.
If your team modifies the local Docker environment—such as changing a local Redis port from 6379 to 6380 —update the .env.dist.local file immediately. This ensures that the next time a teammate pulls the main branch, their template updates automatically. A Typical Setup Example
Adopting the .env.dist.local pattern requires more than just creating the right files—it demands a disciplined approach to configuration management.
If you decide to implement .env.dist.local in your project workflow, follow these security and structural rules: Commit to Git (With Caution)