DEV Community

Discussion on: Node.js: A Guide to Native .env Support and local development

Collapse
 
radcapitalist profile image
Eric Hill

Allowing a .env file on the command line is fine as far is it goes, but with tools like dotenv and dotenv-safe, you can load the environment in from code. In fact, that was the only way. This is much more generally supported than a command line option. When I use sequelize to do database migrations, I need to load my .env file into that process. But I don't have the ability to add options to the node.js command line that sequelize invokes. With dotenv, I could put code in the config file that sequelize migrations use to load in my .env file.

I think in addition to the command line option, node needs an API to load in environment variables so that it is more flexible.

Thanks,

Eric