Node.js 20.6.0, the latest version of the asynchronous, event-driven JavaScript runtime, includes built-in
1 | env. |
file support for configuring environment variables.
The update, cited as the “current” version of Node.js and announced September 4, can be downloaded from the project website. With
1 | env. |
, Node.js proponents said the configuration file should follow the INI file format, with each line having a key-value pair for an environment variable. To initialize the Node.js application with predefined configurations, developers can use this CLI command:
1 | node—file=config.env index.js |
. In addition, the change for environment variables enables definition of
1 | NODE_OPTIONS |
directly in the
1 | .env |
file, eliminating the need to put it in
1 | package.json |
.
0 Comments