Description
The .gitignore generated by express-generator --git currently ignores .env, but does not ignore environment-specific dotenv files such as .env.local, .env.development, or .env.production.
For example, the current template contains:
# dotenv environment variables file
.env
I propose updating this to:
# dotenv environment variable files
.env
.env.*
!.env.example
This would help protect environment-specific configuration files that may contain credentials or other sensitive values, while still allowing projects to commit a safe .env.example file.
Why?
Node.js applications commonly use multiple dotenv files for different environments, for example:
.env
.env.local
.env.development
.env.production
.env.test
Ignoring only .env does not cover these additional .env.* files.
The proposed pattern follows a commonly used approach in modern Node.js project templates.
Proposed change
Update the JavaScript .gitignore template in:
templates/js/gitignore
from:
# dotenv environment variables file
.env
to:
# dotenv environment variable files
.env
.env.*
!.env.example
I would also be happy to add or update the relevant tests if this change is accepted.
Would this be a change the maintainers would be open to?
Description
The
.gitignoregenerated byexpress-generator --gitcurrently ignores.env, but does not ignore environment-specific dotenv files such as.env.local,.env.development, or.env.production.For example, the current template contains:
I propose updating this to:
This would help protect environment-specific configuration files that may contain credentials or other sensitive values, while still allowing projects to commit a safe
.env.examplefile.Why?
Node.js applications commonly use multiple dotenv files for different environments, for example:
.env.env.local.env.development.env.production.env.testIgnoring only
.envdoes not cover these additional.env.*files.The proposed pattern follows a commonly used approach in modern Node.js project templates.
Proposed change
Update the JavaScript
.gitignoretemplate in:templates/js/gitignorefrom:
to:
I would also be happy to add or update the relevant tests if this change is accepted.
Would this be a change the maintainers would be open to?