Gathering detailed insights and metrics for @maximumquiet/dotenv-expand
Gathering detailed insights and metrics for @maximumquiet/dotenv-expand
Gathering detailed insights and metrics for @maximumquiet/dotenv-expand
Gathering detailed insights and metrics for @maximumquiet/dotenv-expand
Variable expansion for dotenv. Expand variables already on your machine for use in your .env file.
npm install @maximumquiet/dotenv-expand
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (99.5%)
TypeScript (0.5%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
BSD-2-Clause License
1,011 Stars
267 Commits
98 Forks
5 Watchers
1 Branches
23 Contributors
Updated on Jul 08, 2025
Latest Version
9.0.1
Package Id
@maximumquiet/dotenv-expand@9.0.1
Unpacked Size
12.85 kB
Size
5.28 kB
File Count
7
NPM Version
8.19.2
Node Version
19.0.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
6
Dotenv libraries are supported by the community.
Special thanks to:Dotenv-expand adds variable expansion on top of dotenv. If you find yourself needing to expand environment variables already existing on your machine, then dotenv-expand is your tool.
1# Install locally (recommended) 2npm install dotenv-expand --save
Or installing with yarn? yarn add dotenv-expand
Create a .env
file in the root of your project:
1PASSWORD="s1mpl3" 2DB_PASS=$PASSWORD 3
As early as possible in your application, import and configure dotenv and then expand dotenv:
1var dotenv = require('dotenv') 2var dotenvExpand = require('dotenv-expand') 3 4var myEnv = dotenv.config() 5dotenvExpand.expand(myEnv) 6 7console.log(process.env)
That's it. process.env
now has the expanded keys and values you defined in your .env
file.
You can use the --require
(-r
) command line option to preload dotenv & dotenv-
. By doing this, you do not need to require and load dotenv or dotenv-expand in your application code. This is the preferred approach when using import
instead of require
.
1$ node -r dotenv-expand/config your_script.js
The configuration options below are supported as command line arguments in the format dotenv_config_<option>=value
1$ node -r dotenv-expand/config your_script.js dotenv_config_path=/custom/path/to/your/env/vars
Additionally, you can use environment variables to set configuration options. Command line arguments will precede these.
1$ DOTENV_CONFIG_<OPTION>=value node -r dotenv-expand/config your_script.js
1$ DOTENV_CONFIG_ENCODING=latin1 node -r dotenv-expand/config your_script.js dotenv_config_path=/custom/path/to/.env
See tests/.env for simple and complex examples of variable expansion in your .env
file.
DotenvExpand exposes one function:
expand
will expand your environment variables.
1const dotenv = { 2 parsed: { 3 BASIC: 'basic', 4 BASIC_EXPAND: '${BASIC}', 5 BASIC_EXPAND_SIMPLE: '$BASIC' 6 } 7} 8 9const obj = dotenvExpand.expand(dotenv) 10 11console.log(obj)
Default: false
Turn off writing to process.env
.
1const dotenv = { 2 ignoreProcessEnv: true, 3 parsed: { 4 SHOULD_NOT_EXIST: 'testing' 5 } 6} 7const obj = dotenvExpand.expand(dotenv).parsed 8 9console.log(obj.SHOULD_NOT_EXIST) // testing 10console.log(process.env.SHOULD_NOT_EXIST) // undefined
The expansion engine roughly has the following rules:
$KEY
will expand any env with the name KEY
${KEY}
will expand any env with the name KEY
\$KEY
will escape the $KEY
rather than expand${KEY:-default}
will first attempt to expand any env with the name KEY
. If not one, then it will return default
You can see a full list of examples here.
See CONTRIBUTING.md
See CHANGELOG.md
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
4 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 3
Reason
7 existing vulnerabilities detected
Details
Reason
Found 1/22 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More