@dotenvx/dotenvx 2.22.0 → 2.24.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 +22 -1
- package/README.md +40 -33
- 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 +10 -3
- package/src/cli/help.js +2 -2
- package/src/lib/helpers/dotenvOptionPaths.js +5 -1
- package/src/lib/helpers/executeCommand.js +1 -17
- 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,28 @@
|
|
|
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.24.0...main)
|
|
6
|
+
|
|
7
|
+
## [2.24.0](https://github.com/dotenvx/dotenvx/compare/v2.23.0...v2.24.0) (2026-09-10)
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
* Do not expand nested commands ([#965](https://github.com/dotenvx/dotenvx/pull/965))
|
|
12
|
+
|
|
13
|
+
### Removed
|
|
14
|
+
|
|
15
|
+
* BREAKING: Remove the `-p` shorthand for `--plain`; use `--plain` instead
|
|
16
|
+
|
|
17
|
+
## [2.23.0](https://github.com/dotenvx/dotenvx/compare/v2.22.0...v2.23.0) (2026-08-31)
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
* Support comma-separated env file paths with `-f` and the `config({ path })` option. Example: `dotenvx run -f .env.local,.env -- node index.js`
|
|
22
|
+
* Add `DOTENV_PATH` (or `DOTENV_F`) to support the same. Example: `DOTENV_PATH=.env.local,.env`
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
* Rename `DOTENV_CONFIG_*` variables to `DOTENV_CONVENTION`, `DOTENV_IGNORE`, and `DOTENV_QUIET`, while retaining their existing `DOTENV_CONFIG_*` names as fallbacks
|
|
6
27
|
|
|
7
28
|
## [2.22.0](https://github.com/dotenvx/dotenvx/compare/v2.21.0...v2.22.0) (2026-08-27)
|
|
8
29
|
|
package/README.md
CHANGED
|
@@ -747,12 +747,12 @@ $ echo "HELLO=local" > .env.local
|
|
|
747
747
|
|
|
748
748
|
$ echo "HELLO=World" > .env
|
|
749
749
|
|
|
750
|
-
$ dotenvx run -f .env.local
|
|
750
|
+
$ dotenvx run -f .env.local,.env -- node index.js
|
|
751
751
|
[dotenvx@1.X.X] injecting env (1) from .env.local,.env
|
|
752
752
|
Hello local
|
|
753
753
|
```
|
|
754
754
|
|
|
755
|
-
|
|
755
|
+
Comma-separate multiple files after a single `-f`. Subsequent files do NOT override pre-existing variables defined in previous files or env. This follows historic principle. For example, above `local` wins – from the first file.
|
|
756
756
|
|
|
757
757
|
</details>
|
|
758
758
|
|
|
@@ -763,7 +763,7 @@ $ echo "HELLO=local" > .env.local
|
|
|
763
763
|
|
|
764
764
|
$ echo "HELLO=World" > .env
|
|
765
765
|
|
|
766
|
-
$ dotenvx run -f .env.local
|
|
766
|
+
$ dotenvx run -f .env.local,.env --overload -- node index.js
|
|
767
767
|
[dotenvx@1.X.X] injecting env (1) from .env.local,.env
|
|
768
768
|
Hello World
|
|
769
769
|
```
|
|
@@ -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
|
|
|
@@ -1267,7 +1267,7 @@ Hello World
|
|
|
1267
1267
|
```
|
|
1268
1268
|
|
|
1269
1269
|
</details>
|
|
1270
|
-
<details><summary>`run` - multiple
|
|
1270
|
+
<details><summary>`run -f` - multiple files</summary><br>
|
|
1271
1271
|
|
|
1272
1272
|
Compose multiple `.env` files for environment variables loading, as you need.
|
|
1273
1273
|
|
|
@@ -1276,12 +1276,12 @@ $ echo "HELLO=local" > .env.local
|
|
|
1276
1276
|
$ echo "HELLO=World" > .env
|
|
1277
1277
|
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
|
1278
1278
|
|
|
1279
|
-
$ dotenvx run -f .env.local
|
|
1279
|
+
$ dotenvx run -f .env.local,.env -- node index.js
|
|
1280
1280
|
[dotenvx@1.X.X] injecting env (1) from .env.local, .env
|
|
1281
1281
|
Hello local
|
|
1282
1282
|
```
|
|
1283
1283
|
|
|
1284
|
-
|
|
1284
|
+
Comma-separate multiple files after a single `-f`. Subsequent files do NOT override pre-existing variables defined in previous files or env. This follows historic principle. For example, above `local` wins – from the first file.
|
|
1285
1285
|
|
|
1286
1286
|
</details>
|
|
1287
1287
|
<details><summary>`run --env HELLO=String`</summary><br>
|
|
@@ -1371,7 +1371,7 @@ $ echo "HELLO=local" > .env.local
|
|
|
1371
1371
|
$ echo "HELLO=World" > .env
|
|
1372
1372
|
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
|
1373
1373
|
|
|
1374
|
-
$ dotenvx run -f .env.local
|
|
1374
|
+
$ dotenvx run -f .env.local,.env --overload -- node index.js
|
|
1375
1375
|
[dotenvx@1.X.X] injecting env (1) from .env.local, .env
|
|
1376
1376
|
Hello World
|
|
1377
1377
|
```
|
|
@@ -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>
|
|
@@ -2833,7 +2833,7 @@ Pass multiple `.env` files to generate your `.env.example` file from the combina
|
|
|
2833
2833
|
$ echo "HELLO=World" > .env
|
|
2834
2834
|
$ echo "DB_HOST=example.com" > .env.production
|
|
2835
2835
|
|
|
2836
|
-
$ dotenvx genexample -f .env
|
|
2836
|
+
$ dotenvx genexample -f .env,.env.production
|
|
2837
2837
|
▣ generated (.env.example)
|
|
2838
2838
|
```
|
|
2839
2839
|
|
|
@@ -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
|
|
|
@@ -120,7 +127,7 @@ program.command('set')
|
|
|
120
127
|
.option('-f, --env-file <path>', 'path(s) to your env file(s)', collectEnvs('envFile'), [])
|
|
121
128
|
.option('-fk, --env-keys-file <path>', 'path to your .env.keys file (default: same path as your env file)')
|
|
122
129
|
.option('-c, --encrypt', 'encrypt value', true)
|
|
123
|
-
.option('
|
|
130
|
+
.option('--plain', 'store value as plain text', false)
|
|
124
131
|
.option('--no-create', 'do not create .env file(s) when missing')
|
|
125
132
|
.option('--no-armor', 'disable Dotenvx Armor features')
|
|
126
133
|
.option('--no-native', 'disable OS secret store features')
|
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
|
|
|
@@ -108,7 +108,7 @@ async function executeCommand (commandArgs, env, sensitiveValues = []) {
|
|
|
108
108
|
/* c8 ignore stop */
|
|
109
109
|
|
|
110
110
|
try {
|
|
111
|
-
//
|
|
111
|
+
// Expand only the executable; child arguments and separators pass through unchanged.
|
|
112
112
|
try {
|
|
113
113
|
commandArgs[0] = path.resolve(which.sync(`${commandArgs[0]}`))
|
|
114
114
|
logger.debug(`expanding process command to [${commandArgs.join(' ')}]`)
|
|
@@ -116,22 +116,6 @@ async function executeCommand (commandArgs, env, sensitiveValues = []) {
|
|
|
116
116
|
logger.debug(`could not expand process command. using [${commandArgs.join(' ')}]`)
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
// expand any other commands that follow a --
|
|
120
|
-
let expandNext = false
|
|
121
|
-
for (let i = 0; i < commandArgs.length; i++) {
|
|
122
|
-
if (commandArgs[i] === '--') {
|
|
123
|
-
expandNext = true
|
|
124
|
-
} else if (expandNext) {
|
|
125
|
-
try {
|
|
126
|
-
commandArgs[i] = path.resolve(which.sync(`${commandArgs[i]}`))
|
|
127
|
-
logger.debug(`expanding process command to [${commandArgs.join(' ')}]`)
|
|
128
|
-
} catch (e) {
|
|
129
|
-
logger.debug(`could not expand process command. using [${commandArgs.join(' ')}]`)
|
|
130
|
-
}
|
|
131
|
-
expandNext = false
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
119
|
const redactStdout = sensitiveValues.length > 0
|
|
136
120
|
const redactStderr = sensitiveValues.length > 0
|
|
137
121
|
const usePty = redactStdout && Boolean(
|
|
@@ -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
|
}
|