DEV Community

Discussion on: Environment variables in Node.js. The Right way!

Collapse
 
johnchristopher profile image
johnchristopher

Another option is to use command line arguments like node app.js --option argument which prevents any keys to ever be committed or written to a file since they are only made available at run-time.

It also plays nice with docker since one can just write any secrets into a docker .env file that feeds ENV variables either to a container or an image.