node-js-getting-started
node-js-getting-started copied to clipboard
.env should not be included in source control
@jonmountjoy Per the 12 factor app guidelines on configuration, there should be an explicit split between code and config. .env files should typically be included in a .gitignore and shouldn't be contained within the codebase itself.
If needed, developers can pull different environment config into their own environment with heroku config on the command line to export environment variables.
You are correct, and it's not ideal the way I've done it. It's like that because this code base was written to support the tutorial, which utilizes the existing .env to make it easier for folk to start.
I don't like it though, it's promoting a bad practice I guess, so I'll set about fixing it there and elsewhere sometime in the future. Thanks!
It looks like the first place it is used or mentioned is on this page. Perhaps just changing the instructions to create the file? Better yet (in my opinion) would be to show how to first create the environment variables on heroku and then show how to copy down those environment variables with heroku config -s > .env. Just a thought.
An alternative is to supply a .env.example file with placeholders and instructing the users to rename it to .env during the tutorial.
Yes, We can add .env.example file, I will do those changes. Thanks