@dotenvx/dotenvx 2.22.0 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -1
- package/README.md +32 -25
- package/package.json +1 -1
- package/src/cli/actions/get.js +2 -1
- package/src/cli/actions/run.js +2 -1
- package/src/cli/dotenvx.js +9 -2
- package/src/cli/help.js +2 -2
- package/src/lib/helpers/dotenvOptionPaths.js +5 -1
- package/src/lib/helpers/normalizeDotenvConfigConvention.js +4 -2
- package/src/lib/helpers/normalizeDotenvConfigIgnore.js +2 -1
- package/src/lib/helpers/normalizeDotenvConfigPath.js +14 -0
- package/src/lib/helpers/normalizeDotenvConfigQuiet.js +3 -1
- package/src/lib/main.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v2.
|
|
5
|
+
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v2.23.0...main)
|
|
6
|
+
|
|
7
|
+
## [2.23.0](https://github.com/dotenvx/dotenvx/compare/v2.22.0...v2.23.0) (2026-08-31)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
* Support comma-separated env file paths with `-f` and the `config({ path })` option. Example: `dotenvx run -f .env.local,.env -- node index.js`
|
|
12
|
+
* Add `DOTENV_PATH` (or `DOTENV_F`) to support the same. Example: `DOTENV_PATH=.env.local,.env`
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
* Rename `DOTENV_CONFIG_*` variables to `DOTENV_CONVENTION`, `DOTENV_IGNORE`, and `DOTENV_QUIET`, while retaining their existing `DOTENV_CONFIG_*` names as fallbacks
|
|
6
17
|
|
|
7
18
|
## [2.22.0](https://github.com/dotenvx/dotenvx/compare/v2.21.0...v2.22.0) (2026-08-27)
|
|
8
19
|
|
package/README.md
CHANGED
|
@@ -814,10 +814,10 @@ $ dotenvx run -f .env.production --quiet -- node index.js
|
|
|
814
814
|
Hello production
|
|
815
815
|
```
|
|
816
816
|
|
|
817
|
-
You can also set `
|
|
817
|
+
You can also set `DOTENV_QUIET=true`.
|
|
818
818
|
|
|
819
819
|
```sh
|
|
820
|
-
$
|
|
820
|
+
$ DOTENV_QUIET=true dotenvx run -f .env.production -- node index.js
|
|
821
821
|
Hello production
|
|
822
822
|
```
|
|
823
823
|
|
|
@@ -1530,10 +1530,10 @@ $ dotenvx run -f .env.production --quiet -- node index.js
|
|
|
1530
1530
|
Hello production
|
|
1531
1531
|
```
|
|
1532
1532
|
|
|
1533
|
-
You can also set `
|
|
1533
|
+
You can also set `DOTENV_QUIET=true`.
|
|
1534
1534
|
|
|
1535
1535
|
```sh
|
|
1536
|
-
$
|
|
1536
|
+
$ DOTENV_QUIET=true dotenvx run -f .env.production -- node index.js
|
|
1537
1537
|
Hello production
|
|
1538
1538
|
```
|
|
1539
1539
|
|
|
@@ -1603,10 +1603,10 @@ $ dotenvx run -f .env.missing --ignore=MISSING_ENV_FILE -- node index.js
|
|
|
1603
1603
|
...
|
|
1604
1604
|
```
|
|
1605
1605
|
|
|
1606
|
-
You can also set `
|
|
1606
|
+
You can also set `DOTENV_IGNORE="MISSING_ENV_FILE"`. It is parsed as a comma-separated list.
|
|
1607
1607
|
|
|
1608
1608
|
```sh
|
|
1609
|
-
$
|
|
1609
|
+
$ DOTENV_IGNORE="MISSING_ENV_FILE,OTHER_ERROR_CODE" dotenvx run -f .env.missing -- node index.js
|
|
1610
1610
|
```
|
|
1611
1611
|
</details>
|
|
1612
1612
|
<details><summary>`run --convention=nextjs`</summary><br>
|
|
@@ -1625,10 +1625,10 @@ $ dotenvx run --convention=nextjs -- node index.js
|
|
|
1625
1625
|
Hello development local
|
|
1626
1626
|
```
|
|
1627
1627
|
|
|
1628
|
-
You can also set `
|
|
1628
|
+
You can also set `DOTENV_CONVENTION=nextjs`.
|
|
1629
1629
|
|
|
1630
1630
|
```sh
|
|
1631
|
-
$
|
|
1631
|
+
$ DOTENV_CONVENTION=nextjs dotenvx run -- node index.js
|
|
1632
1632
|
[dotenvx@1.X.X] injecting env (1) from .env.development.local, .env.local, .env.development, .env
|
|
1633
1633
|
Hello development local
|
|
1634
1634
|
```
|
|
@@ -1663,10 +1663,10 @@ $ NODE_ENV=development dotenvx run --convention=flow -- node index.js
|
|
|
1663
1663
|
Hello development local
|
|
1664
1664
|
```
|
|
1665
1665
|
|
|
1666
|
-
You can also set `
|
|
1666
|
+
You can also set `DOTENV_CONVENTION=flow`.
|
|
1667
1667
|
|
|
1668
1668
|
```sh
|
|
1669
|
-
$ NODE_ENV=development
|
|
1669
|
+
$ NODE_ENV=development DOTENV_CONVENTION=flow dotenvx run -- node index.js
|
|
1670
1670
|
[dotenvx@1.X.X] injecting env (1) from .env.development.local, .env.development, .env.local, .env
|
|
1671
1671
|
Hello development local
|
|
1672
1672
|
```
|
|
@@ -1794,10 +1794,10 @@ Ignore multiple error codes by separating them with spaces.
|
|
|
1794
1794
|
$ dotenvx get HELLO --ignore=MISSING_ENV_FILE MISSING_KEY
|
|
1795
1795
|
```
|
|
1796
1796
|
|
|
1797
|
-
You can also set `
|
|
1797
|
+
You can also set `DOTENV_IGNORE`. Its value is a comma-separated list.
|
|
1798
1798
|
|
|
1799
1799
|
```sh
|
|
1800
|
-
$
|
|
1800
|
+
$ DOTENV_IGNORE=MISSING_ENV_FILE,OTHER dotenvx get HELLO
|
|
1801
1801
|
```
|
|
1802
1802
|
|
|
1803
1803
|
</details>
|
|
@@ -1887,10 +1887,10 @@ $ dotenvx get HELLO --convention=nextjs
|
|
|
1887
1887
|
development local
|
|
1888
1888
|
```
|
|
1889
1889
|
|
|
1890
|
-
You can also set `
|
|
1890
|
+
You can also set `DOTENV_CONVENTION=nextjs`.
|
|
1891
1891
|
|
|
1892
1892
|
```sh
|
|
1893
|
-
$
|
|
1893
|
+
$ DOTENV_CONVENTION=nextjs dotenvx get HELLO
|
|
1894
1894
|
development local
|
|
1895
1895
|
```
|
|
1896
1896
|
|
|
@@ -1920,10 +1920,10 @@ $ NODE_ENV=development dotenvx get HELLO --convention=flow
|
|
|
1920
1920
|
development local
|
|
1921
1921
|
```
|
|
1922
1922
|
|
|
1923
|
-
You can also set `
|
|
1923
|
+
You can also set `DOTENV_CONVENTION=flow`.
|
|
1924
1924
|
|
|
1925
1925
|
```sh
|
|
1926
|
-
$ NODE_ENV=development
|
|
1926
|
+
$ NODE_ENV=development DOTENV_CONVENTION=flow dotenvx get HELLO
|
|
1927
1927
|
development local
|
|
1928
1928
|
```
|
|
1929
1929
|
|
|
@@ -2801,10 +2801,10 @@ Ignore multiple error codes by separating them with spaces.
|
|
|
2801
2801
|
$ dotenvx validate --ignore=MISSING_ENV_FILE MISSING_ENV_EXAMPLE
|
|
2802
2802
|
```
|
|
2803
2803
|
|
|
2804
|
-
You can also set `
|
|
2804
|
+
You can also set `DOTENV_IGNORE`. Its value is a comma-separated list.
|
|
2805
2805
|
|
|
2806
2806
|
```sh
|
|
2807
|
-
$
|
|
2807
|
+
$ DOTENV_IGNORE=MISSING_ENV_FILE,OTHER dotenvx validate
|
|
2808
2808
|
```
|
|
2809
2809
|
|
|
2810
2810
|
</details>
|
|
@@ -3413,10 +3413,10 @@ Error: [MISSING_ENV_FILE] missing .env.missing file (/path/to/.env.missing)
|
|
|
3413
3413
|
Hello World
|
|
3414
3414
|
```
|
|
3415
3415
|
|
|
3416
|
-
You can also set `
|
|
3416
|
+
You can also set `DOTENV_QUIET=true`.
|
|
3417
3417
|
|
|
3418
3418
|
```sh
|
|
3419
|
-
$
|
|
3419
|
+
$ DOTENV_QUIET=true node index.js
|
|
3420
3420
|
Error: [MISSING_ENV_FILE] missing .env.missing file (/path/to/.env.missing)
|
|
3421
3421
|
Hello World
|
|
3422
3422
|
```
|
|
@@ -3521,10 +3521,10 @@ This is equivalent to using `--convention=nextjs` with the CLI:
|
|
|
3521
3521
|
$ dotenvx run --convention=nextjs -- node index.js
|
|
3522
3522
|
```
|
|
3523
3523
|
|
|
3524
|
-
You can also set `
|
|
3524
|
+
You can also set `DOTENV_CONVENTION=nextjs`.
|
|
3525
3525
|
|
|
3526
3526
|
```sh
|
|
3527
|
-
$
|
|
3527
|
+
$ DOTENV_CONVENTION=nextjs node index.js
|
|
3528
3528
|
```
|
|
3529
3529
|
|
|
3530
3530
|
</details>
|
|
@@ -3727,9 +3727,16 @@ There are global settings available that can be configured as environment variab
|
|
|
3727
3727
|
|
|
3728
3728
|
```ini
|
|
3729
3729
|
# config
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3730
|
+
DOTENV_CONVENTION= # set to a default convention like 'nextjs' or 'flow'
|
|
3731
|
+
DOTENV_PATH= # path to your env file; comma-separate multiple paths
|
|
3732
|
+
DOTENV_F= # synonym for DOTENV_PATH
|
|
3733
|
+
DOTENV_IGNORE= # MISSING_ENV_FILE,OTHER
|
|
3734
|
+
DOTENV_QUIET= # set to "true" to default to --quiet
|
|
3735
|
+
|
|
3736
|
+
# legacy aliases (still supported)
|
|
3737
|
+
DOTENV_CONFIG_CONVENTION=
|
|
3738
|
+
DOTENV_CONFIG_IGNORE=
|
|
3739
|
+
DOTENV_CONFIG_QUIET=
|
|
3733
3740
|
|
|
3734
3741
|
# armor
|
|
3735
3742
|
DOTENVX_ARMOR_TOKEN= # for api calls
|
package/package.json
CHANGED
package/src/cli/actions/get.js
CHANGED
|
@@ -7,6 +7,7 @@ const Session = require('../../db/session')
|
|
|
7
7
|
const getResolver = require('./../../lib/resolvers/get')
|
|
8
8
|
const normalizeDotenvConfigConvention = require('../../lib/helpers/normalizeDotenvConfigConvention')
|
|
9
9
|
const normalizeDotenvConfigIgnore = require('../../lib/helpers/normalizeDotenvConfigIgnore')
|
|
10
|
+
const normalizeDotenvConfigPath = require('../../lib/helpers/normalizeDotenvConfigPath')
|
|
10
11
|
const buildCommandEnvs = require('../../lib/helpers/buildCommandEnvs')
|
|
11
12
|
const resolveEnvKeysFile = require('../../lib/helpers/resolveEnvKeysFile')
|
|
12
13
|
const mask = require('../../lib/helpers/mask')
|
|
@@ -26,7 +27,7 @@ async function get (key) {
|
|
|
26
27
|
const ignore = options.ignore || []
|
|
27
28
|
let errorCount = 0
|
|
28
29
|
|
|
29
|
-
const envs = buildCommandEnvs(this.envs, options.convention)
|
|
30
|
+
const envs = buildCommandEnvs(normalizeDotenvConfigPath(this.envs), options.convention)
|
|
30
31
|
|
|
31
32
|
try {
|
|
32
33
|
const sesh = new Session()
|
package/src/cli/actions/run.js
CHANGED
|
@@ -9,6 +9,7 @@ const Session = require('../../db/session')
|
|
|
9
9
|
const normalizeDotenvConfigQuiet = require('../../lib/helpers/normalizeDotenvConfigQuiet')
|
|
10
10
|
const normalizeDotenvConfigConvention = require('../../lib/helpers/normalizeDotenvConfigConvention')
|
|
11
11
|
const normalizeDotenvConfigIgnore = require('../../lib/helpers/normalizeDotenvConfigIgnore')
|
|
12
|
+
const normalizeDotenvConfigPath = require('../../lib/helpers/normalizeDotenvConfigPath')
|
|
12
13
|
const buildCommandEnvs = require('../../lib/helpers/buildCommandEnvs')
|
|
13
14
|
const resolveEnvKeysFile = require('../../lib/helpers/resolveEnvKeysFile')
|
|
14
15
|
const mask = require('../../lib/helpers/mask')
|
|
@@ -106,7 +107,7 @@ async function run () {
|
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
try {
|
|
109
|
-
let envs = buildCommandEnvs(this.envs, options.convention)
|
|
110
|
+
let envs = buildCommandEnvs(normalizeDotenvConfigPath(this.envs), options.convention)
|
|
110
111
|
envs = determine(envs, process.env)
|
|
111
112
|
|
|
112
113
|
const {
|
package/src/cli/dotenvx.js
CHANGED
|
@@ -16,8 +16,15 @@ const normalizeDotenvConfigQuiet = require('./../lib/helpers/normalizeDotenvConf
|
|
|
16
16
|
const envs = []
|
|
17
17
|
function collectEnvs (type) {
|
|
18
18
|
return function (value, previous) {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const values = type === 'envFile'
|
|
20
|
+
? value.split(',').map(item => item.trim()).filter(Boolean)
|
|
21
|
+
: [value]
|
|
22
|
+
|
|
23
|
+
for (const item of values) {
|
|
24
|
+
envs.push({ type, value: item })
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return (previous || []).concat(values)
|
|
21
28
|
}
|
|
22
29
|
}
|
|
23
30
|
|
package/src/cli/help.js
CHANGED
|
@@ -162,8 +162,8 @@ Examples:
|
|
|
162
162
|
dotenvx curl "https://armor.dotenvx.com/api/teams/TEAM/join_requests/123/decline" --request POST
|
|
163
163
|
dotenvx curl "https://armor.dotenvx.com/api/armor/TEAM/settings/join_requests" --data '{"value":true}'
|
|
164
164
|
dotenvx curl "https://armor.dotenvx.com/api/logs?team=TEAM"
|
|
165
|
-
dotenvx curl "https://armor.dotenvx.com/api/logs?team=TEAM&
|
|
166
|
-
dotenvx curl "https://armor.dotenvx.com/api/logs?team=TEAM&
|
|
165
|
+
dotenvx curl "https://armor.dotenvx.com/api/logs?team=TEAM&action=keypair/access&actor=USERNAME&result=success&resource=keypair/KEYPAIR_ID&page=1&per=100"
|
|
166
|
+
dotenvx curl "https://armor.dotenvx.com/api/logs?team=TEAM&actor=missing&resource=missing"
|
|
167
167
|
`
|
|
168
168
|
}
|
|
169
169
|
|
|
@@ -5,7 +5,11 @@ function dotenvOptionPaths (options) {
|
|
|
5
5
|
|
|
6
6
|
if (options && options.path) {
|
|
7
7
|
if (!Array.isArray(options.path)) {
|
|
8
|
-
|
|
8
|
+
if (typeof options.path === 'string') {
|
|
9
|
+
optionPaths = options.path.split(',').map(filepath => filepath.trim()).filter(Boolean).map(resolveHome)
|
|
10
|
+
} else {
|
|
11
|
+
optionPaths = [resolveHome(options.path)]
|
|
12
|
+
}
|
|
9
13
|
} else {
|
|
10
14
|
optionPaths = [] // reset default
|
|
11
15
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
function normalizeDotenvConfigConvention (
|
|
2
2
|
/** @type {import('../main').DotenvConfigOptions} */ options
|
|
3
3
|
) {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const convention = process.env.DOTENV_CONVENTION || process.env.DOTENV_CONFIG_CONVENTION
|
|
5
|
+
|
|
6
|
+
if (!options.convention && convention) {
|
|
7
|
+
options.convention = convention
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
return options
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
function normalizeDotenvConfigIgnore (
|
|
2
2
|
/** @type {import('../main').DotenvConfigOptions} */ options
|
|
3
3
|
) {
|
|
4
|
-
const
|
|
4
|
+
const configuredIgnore = process.env.DOTENV_IGNORE ?? process.env.DOTENV_CONFIG_IGNORE ?? ''
|
|
5
|
+
const configIgnore = configuredIgnore
|
|
5
6
|
.split(',')
|
|
6
7
|
.map(code => code.trim())
|
|
7
8
|
.filter(Boolean)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const TYPE_ENV_FILE = 'envFile'
|
|
2
|
+
|
|
3
|
+
function normalizeDotenvConfigPath (envs = [], processEnv = process.env) {
|
|
4
|
+
if (envs.some(env => env.type === TYPE_ENV_FILE)) return envs
|
|
5
|
+
|
|
6
|
+
const configuredEnvFiles = processEnv.DOTENV_PATH || processEnv.DOTENV_F
|
|
7
|
+
if (!configuredEnvFiles) return envs
|
|
8
|
+
|
|
9
|
+
const envFiles = configuredEnvFiles.split(',').map(value => value.trim()).filter(Boolean)
|
|
10
|
+
|
|
11
|
+
return envFiles.map(value => ({ type: TYPE_ENV_FILE, value })).concat(envs)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
module.exports = normalizeDotenvConfigPath
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
function normalizeDotenvConfigQuiet (
|
|
2
2
|
/** @type {import('../main').DotenvConfigOptions} */ options
|
|
3
3
|
) {
|
|
4
|
-
|
|
4
|
+
const quiet = process.env.DOTENV_QUIET ?? process.env.DOTENV_CONFIG_QUIET
|
|
5
|
+
|
|
6
|
+
if (quiet === 'true') {
|
|
5
7
|
options.quiet = true
|
|
6
8
|
}
|
|
7
9
|
|
package/src/lib/main.js
CHANGED
|
@@ -27,6 +27,7 @@ const Errors = require('./helpers/errors')
|
|
|
27
27
|
const normalizeDotenvConfigQuiet = require('./helpers/normalizeDotenvConfigQuiet')
|
|
28
28
|
const normalizeDotenvConfigConvention = require('./helpers/normalizeDotenvConfigConvention')
|
|
29
29
|
const normalizeDotenvConfigIgnore = require('./helpers/normalizeDotenvConfigIgnore')
|
|
30
|
+
const normalizeDotenvConfigPath = require('./helpers/normalizeDotenvConfigPath')
|
|
30
31
|
const mask = require('./helpers/mask')
|
|
31
32
|
const maskProcessedEnvs = require('./helpers/maskProcessedEnvs')
|
|
32
33
|
|
|
@@ -75,7 +76,7 @@ const config = function (options = {}) {
|
|
|
75
76
|
const noKeychain = resolveNoKeychain(options)
|
|
76
77
|
|
|
77
78
|
try {
|
|
78
|
-
let envs = buildConfigEnvs(options)
|
|
79
|
+
let envs = normalizeDotenvConfigPath(buildConfigEnvs(options))
|
|
79
80
|
if (!options.envs) {
|
|
80
81
|
envs = determine(envs, processEnv)
|
|
81
82
|
}
|