
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Loads environment variables from a chosen .env
file into process.env
, using dotenv and dotenv-expand
Adds
.env
variables toprocess.env
package.json
"scripts": {
"test" : "env-path -p path/.env node app.js"
"build" : "env-path -p path/.env.production, react-scripts build"
"start" : "env-path -p otherPath/.env-file react-script start",
}
$ npm install env-path
Thanks to dotenv-expand, we can use variables inside our .env
file.
See simple .env
file under
API_KEY=key
PORT=3000
MONGO_DB=myDB
MONGO_URL=mongodb://localhost:27017/${MONGO_DB}
REACT_APP_VERSION=$npm_package_version
Preloads dotenv and dotenv-expand. By doing this, you do not need to require and load dotenv and dotenv-expand in your application code.
Specify a path using the -p
flag:
$ env-path -p path/.env-file node app.js
package.json
"scripts": {
"build" : "env-path -p path/.env.production, react-scripts build"
"start" : "env-path -p path/.env-file react-script start",
"start2" : "env-path -p path/.env.development node app.js",
"start3" : "env-path -p path/otherFileName.env node app.js",
}
Works similar to dotenv's Preload
See dotenv docs
$ env-path node app.js
package.json
"scripts": {
"start" : "env-path node app.js",
"build" : "env-path react-scripts build"
}
FAQs
Loads environment variables from a chosen .env file into process.env
The npm package env-path receives a total of 4,480 weekly downloads. As such, env-path popularity was classified as popular.
We found that env-path demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.