@dotenvx/dotenvx 2.11.0 → 2.11.2

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 CHANGED
@@ -2,7 +2,21 @@
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.11.0...main)
5
+ [Unreleased](https://github.com/dotenvx/dotenvx/compare/v2.11.2...main)
6
+
7
+ ## [2.11.2](https://github.com/dotenvx/dotenvx/compare/v2.11.1...v2.11.2) (2026-07-16)
8
+
9
+ ### Changed
10
+
11
+ * Bump @dotenvx/primtivies to support nested node invocations for pkg-ed binary ([#901](https://github.com/dotenvx/dotenvx/pull/901))
12
+
13
+ ## [2.11.1](https://github.com/dotenvx/dotenvx/compare/v2.11.0...v2.11.1) (2026-07-15)
14
+
15
+ ### Changed
16
+
17
+ * Redact all keys by default - except those ending in `_PLAIN` ([460862](https://github.com/dotenvx/dotenvx/commit/4608625845367d9205aa668826bf46ed0e5bb740))
18
+ * Support `dotenvx run -- claude` and `dotenvx run -- codex` ([#900](https://github.com/dotenvx/dotenvx/pull/900))
19
+ * Simplify default encrypted .env file to just `HELLO="World"` ([#899](https://github.com/dotenvx/dotenvx/pull/899))
6
20
 
7
21
  ## [2.11.0](https://github.com/dotenvx/dotenvx/compare/v2.10.0...v2.11.0) (2026-07-15)
8
22
 
package/README.md CHANGED
@@ -111,14 +111,14 @@ dotenvx encrypt
111
111
  ## Run Anywhere
112
112
 
113
113
  ```sh
114
- $ echo "HELLO=Dotenvx" > .env
114
+ $ echo "HELLO=World" > .env
115
115
  $ echo "console.log('Hello ' + process.env.HELLO)" > index.js
116
116
 
117
117
  $ node index.js
118
118
  Hello undefined # without dotenvx
119
119
 
120
120
  $ dotenvx run -- node index.js
121
- Hello Dotenvx # with dotenvx
121
+ Hello World # with dotenvx
122
122
  > :-D
123
123
  ```
124
124
 
@@ -126,6 +126,34 @@ see [quickstart guides](https://dotenvx.com/docs/quickstart)
126
126
 
127
127
  More examples
128
128
 
129
+ <details><summary>Claude 🤖</summary><br>
130
+
131
+ Run Claude with your real secrets while redacting them from its output.
132
+
133
+ ```sh
134
+ $ echo "HELLO=World" > .env
135
+
136
+ $ dotenvx run --redact -- claude -p 'Run `dotenvx get HELLO` and echo back just Hello VALUE' --dangerously-skip-permissions
137
+ Hello [REDACTED]
138
+ ```
139
+
140
+ see [Claude redaction guide](https://dotenvx.com/docs/cli/run-redact-claude-print)
141
+
142
+ </details>
143
+ <details><summary>Codex ✨</summary><br>
144
+
145
+ Run Codex with your real secrets while redacting them from its output.
146
+
147
+ ```sh
148
+ $ echo "HELLO=World" > .env
149
+
150
+ $ dotenvx run --redact -- codex exec 'Run `dotenvx get HELLO` and echo back just Hello VALUE' --skip-git-repo-check
151
+ Hello [REDACTED]
152
+ ```
153
+
154
+ see [Codex redaction guide](https://dotenvx.com/docs/cli/run-redact-codex-exec)
155
+
156
+ </details>
129
157
  <details><summary>TypeScript 📘</summary><br>
130
158
 
131
159
  ```json
@@ -146,10 +174,10 @@ console.log(chalk.blue(`Hello ${process.env.HELLO}`))
146
174
 
147
175
  ```sh
148
176
  $ npm install
149
- $ echo "HELLO=Dotenvx" > .env
177
+ $ echo "HELLO=World" > .env
150
178
 
151
179
  $ dotenvx run -- npx tsx index.ts
152
- Hello Dotenvx
180
+ Hello World
153
181
  ```
154
182
 
155
183
  </details>
@@ -293,14 +321,14 @@ Hello Test
293
321
  <details><summary>Deno 🦕</summary><br>
294
322
 
295
323
  ```sh
296
- $ echo "HELLO=Dotenvx" > .env
324
+ $ echo "HELLO=World" > .env
297
325
  $ echo "console.log('Hello ' + Deno.env.get('HELLO'))" > index.ts
298
326
 
299
327
  $ deno run --allow-env index.ts
300
328
  Hello undefined
301
329
 
302
330
  $ dotenvx run -- deno run --allow-env index.ts
303
- Hello Dotenvx
331
+ Hello World
304
332
  ```
305
333
 
306
334
  > [!WARNING]
@@ -317,11 +345,11 @@ Hello Dotenvx
317
345
  <details><summary>Python 🐍</summary><br>
318
346
 
319
347
  ```sh
320
- $ echo "HELLO=Dotenvx" > .env
348
+ $ echo "HELLO=World" > .env
321
349
  $ echo 'import os;print("Hello " + os.getenv("HELLO", ""))' > index.py
322
350
 
323
351
  $ dotenvx run -- python3 index.py
324
- Hello Dotenvx
352
+ Hello World
325
353
  ```
326
354
 
327
355
  see [extended python guide](https://dotenvx.com/docs/quickstart)
@@ -330,11 +358,11 @@ see [extended python guide](https://dotenvx.com/docs/quickstart)
330
358
  <details><summary>PHP 🐘</summary><br>
331
359
 
332
360
  ```sh
333
- $ echo "HELLO=Dotenvx" > .env
361
+ $ echo "HELLO=World" > .env
334
362
  $ echo '<?php echo "Hello {$_SERVER["HELLO"]}\n";' > index.php
335
363
 
336
364
  $ dotenvx run -- php index.php
337
- Hello Dotenvx
365
+ Hello World
338
366
  ```
339
367
 
340
368
  see [extended php guide](https://dotenvx.com/docs/quickstart)
@@ -343,11 +371,11 @@ see [extended php guide](https://dotenvx.com/docs/quickstart)
343
371
  <details><summary>Ruby 💎</summary><br>
344
372
 
345
373
  ```sh
346
- $ echo "HELLO=Dotenvx" > .env
374
+ $ echo "HELLO=World" > .env
347
375
  $ echo 'puts "Hello #{ENV["HELLO"]}"' > index.rb
348
376
 
349
377
  $ dotenvx run -- ruby index.rb
350
- Hello Dotenvx
378
+ Hello World
351
379
  ```
352
380
 
353
381
  see [extended ruby guide](https://dotenvx.com/docs/quickstart)
@@ -356,11 +384,11 @@ see [extended ruby guide](https://dotenvx.com/docs/quickstart)
356
384
  <details><summary>Go 🐹</summary><br>
357
385
 
358
386
  ```sh
359
- $ echo "HELLO=Dotenvx" > .env
387
+ $ echo "HELLO=World" > .env
360
388
  $ echo 'package main; import ("fmt"; "os"); func main() { fmt.Printf("Hello %s\n", os.Getenv("HELLO")) }' > main.go
361
389
 
362
390
  $ dotenvx run -- go run main.go
363
- Hello Dotenvx
391
+ Hello World
364
392
  ```
365
393
 
366
394
  see [extended go guide](https://dotenvx.com/docs/quickstart)
@@ -369,11 +397,11 @@ see [extended go guide](https://dotenvx.com/docs/quickstart)
369
397
  <details><summary>Rust 🦀</summary><br>
370
398
 
371
399
  ```sh
372
- $ echo "HELLO=Dotenvx" > .env
400
+ $ echo "HELLO=World" > .env
373
401
  $ echo 'fn main() {let hello = std::env::var("HELLO").unwrap_or("".to_string());println!("Hello {hello}");}' > src/main.rs
374
402
 
375
403
  $ dotenvx run -- cargo run
376
- Hello Dotenvx
404
+ Hello World
377
405
  ```
378
406
 
379
407
  see [extended rust guide](https://dotenvx.com/docs/quickstart)
@@ -382,34 +410,34 @@ see [extended rust guide](https://dotenvx.com/docs/quickstart)
382
410
  <details><summary>Java ☕️</summary><br>
383
411
 
384
412
  ```sh
385
- $ echo "HELLO=Dotenvx" > .env
413
+ $ echo "HELLO=World" > .env
386
414
  $ echo 'public class Index { public static void main(String[] args) { System.out.println("Hello " + System.getenv("HELLO")); } }' > index.java
387
415
 
388
416
  $ dotenvx run -- java index.java
389
- Hello Dotenvx
417
+ Hello World
390
418
  ```
391
419
 
392
420
  </details>
393
421
  <details><summary>Clojure 🌿</summary><br>
394
422
 
395
423
  ```sh
396
- $ echo "HELLO=Dotenvx" > .env
424
+ $ echo "HELLO=World" > .env
397
425
  $ echo '(println "Hello" (System/getenv "HELLO"))' > index.clj
398
426
 
399
427
  $ dotenvx run -- clojure -M index.clj
400
- Hello Dotenvx
428
+ Hello World
401
429
  ```
402
430
 
403
431
  </details>
404
432
  <details><summary>Kotlin 📐</summary><br>
405
433
 
406
434
  ```sh
407
- $ echo "HELLO=Dotenvx" > .env
435
+ $ echo "HELLO=World" > .env
408
436
  $ echo 'fun main() { val hello = System.getenv("HELLO") ?: ""; println("Hello $hello") }' > index.kt
409
437
  $ kotlinc index.kt -include-runtime -d index.jar
410
438
 
411
439
  $ dotenvx run -- java -jar index.jar
412
- Hello Dotenvx
440
+ Hello World
413
441
  ```
414
442
 
415
443
  </details>
@@ -418,31 +446,31 @@ Hello Dotenvx
418
446
  ```sh
419
447
  $ dotnet new console -n HelloWorld -o HelloWorld
420
448
  $ cd HelloWorld
421
- $ echo "HELLO=Dotenvx" | Out-File -FilePath .env -Encoding utf8
449
+ $ echo "HELLO=World" | Out-File -FilePath .env -Encoding utf8
422
450
  $ echo 'Console.WriteLine($"Hello {Environment.GetEnvironmentVariable("HELLO")}");' > Program.cs
423
451
 
424
452
  $ dotenvx run -- dotnet run
425
- Hello Dotenvx
453
+ Hello World
426
454
  ```
427
455
 
428
456
  </details>
429
457
  <details><summary>Bash 🖥️</summary><br>
430
458
 
431
459
  ```sh
432
- $ echo "HELLO=Dotenvx" > .env
460
+ $ echo "HELLO=World" > .env
433
461
 
434
462
  $ dotenvx run --quiet -- sh -c 'echo Hello $HELLO'
435
- Hello Dotenvx
463
+ Hello World
436
464
  ```
437
465
 
438
466
  </details>
439
467
  <details><summary>Fish 🐠</summary><br>
440
468
 
441
469
  ```sh
442
- $ echo "HELLO=Dotenvx" > .env
470
+ $ echo "HELLO=World" > .env
443
471
 
444
472
  $ dotenvx run --quiet -- sh -c 'echo Hello $HELLO'
445
- Hello Dotenvx
473
+ Hello World
446
474
  ```
447
475
 
448
476
  </details>
@@ -476,7 +504,7 @@ Or in any image:
476
504
 
477
505
  ```Containerfile
478
506
  FROM node:latest
479
- RUN echo "HELLO=Dotenvx" > .env && echo "console.log('Hello ' + process.env.HELLO)" > index.js
507
+ RUN echo "HELLO=World" > .env && echo "console.log('Hello ' + process.env.HELLO)" > index.js
480
508
  RUN curl -fsS https://dotenvx.sh/install.sh | sh
481
509
  CMD ["/usr/local/bin/dotenvx", "run", "--", "echo", "Hello $HELLO"]
482
510
  ```
@@ -568,7 +596,7 @@ $ npm run start
568
596
  > ./node_modules/.bin/dotenvx run -- node index.js
569
597
 
570
598
  [dotenvx@1.X.X] injecting env (1) from .env.production
571
- Hello Dotenvx
599
+ Hello World
572
600
  ```
573
601
 
574
602
  </details>
@@ -656,7 +684,7 @@ More examples
656
684
  ```sh
657
685
  $ echo "HELLO=local" > .env.local
658
686
 
659
- $ echo "HELLO=Dotenvx" > .env
687
+ $ echo "HELLO=World" > .env
660
688
 
661
689
  $ dotenvx run -f .env.local -f .env -- node index.js
662
690
  [dotenvx@1.X.X] injecting env (1) from .env.local,.env
@@ -672,11 +700,11 @@ Note subsequent files do NOT override pre-existing variables defined in previous
672
700
  ```sh
673
701
  $ echo "HELLO=local" > .env.local
674
702
 
675
- $ echo "HELLO=Dotenvx" > .env
703
+ $ echo "HELLO=World" > .env
676
704
 
677
705
  $ dotenvx run -f .env.local -f .env --overload -- node index.js
678
706
  [dotenvx@1.X.X] injecting env (1) from .env.local,.env
679
- Hello Dotenvx
707
+ Hello World
680
708
  ```
681
709
 
682
710
  Note that with `--overload` subsequent files DO override pre-existing variables defined in previous files.
@@ -788,13 +816,13 @@ More examples
788
816
  <details><summary>`.env`</summary><br>
789
817
 
790
818
  ```sh
791
- $ echo "HELLO=Dotenvx" > .env
819
+ $ echo "HELLO=World" > .env
792
820
  $ dotenvx encrypt
793
821
  $ echo "console.log('Hello ' + process.env.HELLO)" > index.js
794
822
 
795
823
  $ dotenvx run -- node index.js
796
824
  [dotenvx@1.X.X] injecting env (2) from .env
797
- Hello Dotenvx
825
+ Hello World
798
826
  ```
799
827
 
800
828
  </details>
@@ -831,13 +859,13 @@ Note the `DOTENV_PRIVATE_KEY_CI` ends with `_CI`. This instructs `dotenvx run` t
831
859
  <details><summary>combine multiple encrypted .env files</summary><br>
832
860
 
833
861
  ```sh
834
- $ dotenvx set HELLO Dotenvx -f .env
862
+ $ dotenvx set HELLO World -f .env
835
863
  $ dotenvx set HELLO Production -f .env.production
836
864
  $ echo "console.log('Hello ' + process.env.HELLO)" > index.js
837
865
 
838
866
  $ DOTENV_PRIVATE_KEY="<.env private key>" DOTENV_PRIVATE_KEY_PRODUCTION="<.env.production private key>" dotenvx run -- node index.js
839
867
  [dotenvx@1.X.X] injecting env (3) from .env, .env.production
840
- Hello Dotenvx
868
+ Hello World
841
869
  ```
842
870
 
843
871
  Note the `DOTENV_PRIVATE_KEY` instructs `dotenvx run` to load the `.env` file and the `DOTENV_PRIVATE_KEY_PRODUCTION` instructs it to load the `.env.production` file. See the pattern?
@@ -887,7 +915,7 @@ $ dotenvx run -f . -fk ../.. -- node index.js
887
915
  <details><summary>`--stdout`</summary><br>
888
916
 
889
917
  ```sh
890
- $ echo "HELLO=Dotenvx" > .env
918
+ $ echo "HELLO=World" > .env
891
919
  $ dotenvx encrypt --stdout
892
920
  $ dotenvx encrypt --stdout > .env.encrypted
893
921
  ```
@@ -1072,8 +1100,8 @@ DATABASE_URL postgres://yourusername@localhost/my_database
1072
1100
  Prevent your shell from expanding inline `$VARIABLES` before dotenvx has a chance to inject it. Use a subshell.
1073
1101
 
1074
1102
  ```sh
1075
- $ dotenvx run --env="HELLO=Dotenvx" -- sh -c 'echo Hello $HELLO'
1076
- Hello Dotenvx
1103
+ $ dotenvx run --env="HELLO=World" -- sh -c 'echo Hello $HELLO'
1104
+ Hello World
1077
1105
  ```
1078
1106
 
1079
1107
  </details>
@@ -1117,13 +1145,13 @@ For example, when missing a custom .env file:
1117
1145
 
1118
1146
  ```sh
1119
1147
  $ dotenvx run -f .env.missing -- echo $HELLO
1120
- [MISSING_ENV_FILE] missing file (/Users/scottmotte/Code/dotenvx/playground/apr-16/.env.missing). fix: [echo "HELLO=Dotenvx" > .env.missing]
1148
+ [MISSING_ENV_FILE] missing file (/Users/scottmotte/Code/dotenvx/playground/apr-16/.env.missing). fix: [echo "HELLO=World" > .env.missing]
1121
1149
  ```
1122
1150
 
1123
1151
  or when missing a KEY:
1124
1152
 
1125
1153
  ```sh
1126
- $ echo "HELLO=Dotenvx" > .env
1154
+ $ echo "HELLO=World" > .env
1127
1155
  $ dotenvx get GOODBYE
1128
1156
  [MISSING_KEY] missing key (GOODBYE)
1129
1157
  ```
@@ -1146,7 +1174,7 @@ Compose multiple `.env` files for environment variables loading, as you need.
1146
1174
 
1147
1175
  ```sh
1148
1176
  $ echo "HELLO=local" > .env.local
1149
- $ echo "HELLO=Dotenvx" > .env
1177
+ $ echo "HELLO=World" > .env
1150
1178
  $ echo "console.log('Hello ' + process.env.HELLO)" > index.js
1151
1179
 
1152
1180
  $ dotenvx run -f .env.local -f .env -- node index.js
@@ -1162,7 +1190,7 @@ Note subsequent files do NOT override pre-existing variables defined in previous
1162
1190
  Set environment variables as a simple `KEY=value` string pair.
1163
1191
 
1164
1192
  ```sh
1165
- $ echo "HELLO=Dotenvx" > .env
1193
+ $ echo "HELLO=World" > .env
1166
1194
  $ echo "console.log('Hello ' + process.env.HELLO)" > index.js
1167
1195
 
1168
1196
  $ dotenvx run --env HELLO=String -f .env -- node index.js
@@ -1170,6 +1198,70 @@ $ dotenvx run --env HELLO=String -f .env -- node index.js
1170
1198
  Hello String
1171
1199
  ```
1172
1200
 
1201
+ </details>
1202
+ <details><summary>`run --redact`</summary><br>
1203
+
1204
+ Run any command with real environment variables while automatically redacting their values from stdout and stderr. Keys ending in `_PLAIN` are left visible.
1205
+
1206
+ ```sh
1207
+ $ echo "SECRET=super-secret-value" > .env
1208
+ $ echo "VISIBLE_PLAIN=visible-value" >> .env
1209
+ $ echo "console.log(process.env.SECRET, process.env.VISIBLE_PLAIN)" > index.js
1210
+
1211
+ $ dotenvx run --redact --quiet -- node index.js
1212
+ [REDACTED] visible-value
1213
+ ```
1214
+
1215
+ Redaction is off by default. It applies to every key declared in `.env` files and `--env` flags unless the key ends in `_PLAIN`. If an existing environment variable takes precedence, its effective value is redacted too. Matching is exact, so transformed or derived values are not redacted.
1216
+
1217
+ When stdin, stdout, and stderr are attached to a terminal, dotenvx preserves interactive behavior on macOS and Linux systems with `script` available. Piped and redirected commands continue to use normal stdin, stdout, and stderr streams.
1218
+
1219
+ </details>
1220
+ <details><summary>`run --redact -- claude -p`</summary><br>
1221
+
1222
+ Run Claude in print mode with real environment variables while redacting any values it prints.
1223
+
1224
+ ```sh
1225
+ $ echo "SECRET=super-secret-value" > .env
1226
+
1227
+ $ dotenvx run --redact --quiet -- claude -p 'Print the value of $SECRET'
1228
+ [REDACTED]
1229
+ ```
1230
+
1231
+ </details>
1232
+ <details><summary>`run --redact -- claude`</summary><br>
1233
+
1234
+ Start a fully interactive Claude session. Claude receives the real values, but any values it prints are redacted.
1235
+
1236
+ ```sh
1237
+ $ echo "SECRET=super-secret-value" > .env
1238
+
1239
+ $ dotenvx run --redact --quiet -- claude
1240
+ ```
1241
+
1242
+ </details>
1243
+ <details><summary>`run --redact -- codex exec`</summary><br>
1244
+
1245
+ Run Codex non-interactively with real environment variables while redacting any values it prints.
1246
+
1247
+ ```sh
1248
+ $ echo "SECRET=super-secret-value" > .env
1249
+
1250
+ $ dotenvx run --redact --quiet -- codex exec 'Print the value of $SECRET'
1251
+ [REDACTED]
1252
+ ```
1253
+
1254
+ </details>
1255
+ <details><summary>`run --redact -- codex`</summary><br>
1256
+
1257
+ Start a fully interactive Codex session. Codex receives the real values, but any values it prints are redacted.
1258
+
1259
+ ```sh
1260
+ $ echo "SECRET=super-secret-value" > .env
1261
+
1262
+ $ dotenvx run --redact --quiet -- codex
1263
+ ```
1264
+
1173
1265
  </details>
1174
1266
  <details><summary>`run --overload`</summary><br>
1175
1267
 
@@ -1177,12 +1269,12 @@ Override existing env variables. These can be variables already on your machine
1177
1269
 
1178
1270
  ```sh
1179
1271
  $ echo "HELLO=local" > .env.local
1180
- $ echo "HELLO=Dotenvx" > .env
1272
+ $ echo "HELLO=World" > .env
1181
1273
  $ echo "console.log('Hello ' + process.env.HELLO)" > index.js
1182
1274
 
1183
1275
  $ dotenvx run -f .env.local -f .env --overload -- node index.js
1184
1276
  [dotenvx@1.X.X] injecting env (1) from .env.local, .env
1185
- Hello Dotenvx
1277
+ Hello World
1186
1278
  ```
1187
1279
 
1188
1280
  Note that with `--overload` subsequent files DO override pre-existing variables defined in previous files.
@@ -1370,7 +1462,7 @@ Exit with code `1` if any errors are encountered - like a missing .env file or d
1370
1462
  $ echo "console.log('Hello ' + process.env.HELLO)" > index.js
1371
1463
 
1372
1464
  $ dotenvx run -f .env.missing --strict -- node index.js
1373
- [MISSING_ENV_FILE] missing file (/path/to/.env.missing). fix: [echo "HELLO=Dotenvx" > .env.missing]
1465
+ [MISSING_ENV_FILE] missing file (/path/to/.env.missing). fix: [echo "HELLO=World" > .env.missing]
1374
1466
  ```
1375
1467
 
1376
1468
  This can be useful in `ci` scripts where you want to fail the ci if your `.env` file could not be decrypted at runtime.
@@ -1466,29 +1558,11 @@ Specify path to `.env.keys`. This is useful with monorepos.
1466
1558
  ```sh
1467
1559
  $ mkdir -p apps/app1
1468
1560
  $ touch apps/app1/.env
1469
- $ dotenvx set HELLO Dotenvx -fk .env.keys -f apps/app1/.env
1561
+ $ dotenvx set HELLO World -fk .env.keys -f apps/app1/.env
1470
1562
 
1471
1563
  $ dotenvx run -fk .env.keys -f apps/app1/.env -- yourcommand
1472
1564
  ```
1473
1565
 
1474
- </details>
1475
- <details><summary>`run --redact`</summary><br>
1476
-
1477
- Redact successfully decrypted values from the command's stdout and stderr. The command still receives the real values; only its output is filtered.
1478
-
1479
- ```sh
1480
- $ touch .env
1481
- $ dotenvx set SECRET super-secret-value
1482
- $ echo "console.log(process.env.SECRET)" > index.js
1483
-
1484
- $ dotenvx run --redact --quiet -- node index.js
1485
- [REDACTED]
1486
- ```
1487
-
1488
- Redaction is off by default. It applies only to values that were encrypted, successfully decrypted, and injected. Plaintext values are left unchanged. Matching is exact, so transformed or derived values are not redacted.
1489
-
1490
- Because redaction filters stdout and stderr, interactive commands that require a TTY may behave differently.
1491
-
1492
1566
  </details>
1493
1567
  <details><summary>`run --mask`</summary><br>
1494
1568
 
@@ -1537,7 +1611,7 @@ $ dotenvx run --no-armor -- yourcommand
1537
1611
  Return a single environment variable's value.
1538
1612
 
1539
1613
  ```sh
1540
- $ echo "HELLO=Dotenvx" > .env
1614
+ $ echo "HELLO=World" > .env
1541
1615
 
1542
1616
  $ dotenvx get HELLO
1543
1617
  World
@@ -1572,7 +1646,7 @@ $ dotenvx get HELLO --no-native
1572
1646
  Return a single environment variable's value from a specific `.env` file.
1573
1647
 
1574
1648
  ```sh
1575
- $ echo "HELLO=Dotenvx" > .env
1649
+ $ echo "HELLO=World" > .env
1576
1650
  $ echo "HELLO=production" > .env.production
1577
1651
 
1578
1652
  $ dotenvx get HELLO -f .env.production
@@ -1597,7 +1671,7 @@ Specify path to `.env.keys`. This is useful with monorepos.
1597
1671
  ```sh
1598
1672
  $ mkdir -p apps/app1
1599
1673
  $ touch apps/app1/.env
1600
- $ dotenvx set HELLO Dotenvx -fk .env.keys -f apps/app1/.env
1674
+ $ dotenvx set HELLO World -fk .env.keys -f apps/app1/.env
1601
1675
 
1602
1676
  $ dotenvx get HELLO -fk .env.keys -f apps/app1/.env
1603
1677
  world
@@ -1620,7 +1694,7 @@ String
1620
1694
  Return a single environment variable's value where each found value is overloaded.
1621
1695
 
1622
1696
  ```sh
1623
- $ echo "HELLO=Dotenvx" > .env
1697
+ $ echo "HELLO=World" > .env
1624
1698
  $ echo "HELLO=production" > .env.production
1625
1699
 
1626
1700
  $ dotenvx get HELLO -f .env.production --env HELLO=String -f .env --overload
@@ -1706,10 +1780,10 @@ development local
1706
1780
  Return a json response of all key/value pairs in a `.env` file.
1707
1781
 
1708
1782
  ```sh
1709
- $ echo "HELLO=Dotenvx" > .env
1783
+ $ echo "HELLO=World" > .env
1710
1784
 
1711
1785
  $ dotenvx get
1712
- {"HELLO":"Dotenvx"}
1786
+ {"HELLO":"World"}
1713
1787
  ```
1714
1788
 
1715
1789
  </details>
@@ -1718,11 +1792,11 @@ $ dotenvx get
1718
1792
  Return a shell formatted response of all key/value pairs in a `.env` file.
1719
1793
 
1720
1794
  ```sh
1721
- $ echo "HELLO=Dotenvx" > .env
1795
+ $ echo "HELLO=World" > .env
1722
1796
  $ echo "KEY=value" >> .env
1723
1797
 
1724
1798
  $ dotenvx get --format shell
1725
- HELLO=Dotenvx KEY=value
1799
+ HELLO=World KEY=value
1726
1800
  ```
1727
1801
 
1728
1802
  This can be useful when combined with `env` on the command line.
@@ -1748,11 +1822,11 @@ Hello value World
1748
1822
  Return an `eval`-ready shell formatted response of all key/value pairs in a `.env` file.
1749
1823
 
1750
1824
  ```sh
1751
- $ echo "HELLO=Dotenvx" > .env
1825
+ $ echo "HELLO=World" > .env
1752
1826
  $ echo "KEY=value" >> .env
1753
1827
 
1754
1828
  $ dotenvx get --format eval
1755
- HELLO="Dotenvx"
1829
+ HELLO="World"
1756
1830
  KEY="value"
1757
1831
  ```
1758
1832
 
@@ -1775,10 +1849,10 @@ Be careful with `eval` as it allows for arbitrary execution of commands. Prefer
1775
1849
  Return preset machine envs as well.
1776
1850
 
1777
1851
  ```sh
1778
- $ echo "HELLO=Dotenvx" > .env
1852
+ $ echo "HELLO=World" > .env
1779
1853
 
1780
1854
  $ dotenvx get --all
1781
- {"PWD":"/some/file/path","USER":"username","LIBRARY_PATH":"/usr/local/lib", ..., "HELLO":"Dotenvx"}
1855
+ {"PWD":"/some/file/path","USER":"username","LIBRARY_PATH":"/usr/local/lib", ..., "HELLO":"World"}
1782
1856
  ```
1783
1857
 
1784
1858
  </details>
@@ -1787,7 +1861,7 @@ $ dotenvx get --all
1787
1861
  Make the output more readable - pretty print it.
1788
1862
 
1789
1863
  ```sh
1790
- $ echo "HELLO=Dotenvx" > .env
1864
+ $ echo "HELLO=World" > .env
1791
1865
 
1792
1866
  $ dotenvx get --all --pretty-print
1793
1867
  {
@@ -1795,7 +1869,7 @@ $ dotenvx get --all --pretty-print
1795
1869
  "USER": "username",
1796
1870
  "LIBRARY_PATH": "/usr/local/lib",
1797
1871
  ...,
1798
- "HELLO": "Dotenvx"
1872
+ "HELLO": "World"
1799
1873
  }
1800
1874
  ```
1801
1875
 
@@ -1807,7 +1881,7 @@ Set an encrypted key/value (on by default).
1807
1881
  ```sh
1808
1882
  $ touch .env
1809
1883
 
1810
- $ dotenvx set HELLO Dotenvx
1884
+ $ dotenvx set HELLO World
1811
1885
  set HELLO with encryption (.env)
1812
1886
  ```
1813
1887
 
@@ -1834,7 +1908,7 @@ Specify path to `.env.keys`. This is useful with monorepos.
1834
1908
  $ mkdir -p apps/app1
1835
1909
  $ touch apps/app1/.env
1836
1910
 
1837
- $ dotenvx set HELLO Dotenvx -fk .env.keys -f apps/app1/.env
1911
+ $ dotenvx set HELLO World -fk .env.keys -f apps/app1/.env
1838
1912
  set HELLO with encryption (.env)
1839
1913
  ```
1840
1914
 
@@ -1883,7 +1957,7 @@ Set a plaintext key/value.
1883
1957
  ```sh
1884
1958
  $ touch .env
1885
1959
 
1886
- $ dotenvx set HELLO Dotenvx --plain
1960
+ $ dotenvx set HELLO World --plain
1887
1961
  set HELLO (.env)
1888
1962
  ```
1889
1963
 
@@ -1895,7 +1969,7 @@ Set a plaintext key/value inside an encrypted `.env` file by ending the key with
1895
1969
  ```sh
1896
1970
  $ touch .env
1897
1971
 
1898
- $ dotenvx set HELLO_PLAIN Dotenvx
1972
+ $ dotenvx set HELLO_PLAIN World
1899
1973
  set HELLO_PLAIN (.env)
1900
1974
  ```
1901
1975
 
@@ -1907,7 +1981,7 @@ Keys ending in `_PLAIN` are not encrypted by `dotenvx set` or `dotenvx encrypt`.
1907
1981
  Turn off OS secret store lookups for set.
1908
1982
 
1909
1983
  ```sh
1910
- $ dotenvx set HELLO Dotenvx --no-native
1984
+ $ dotenvx set HELLO World --no-native
1911
1985
  ```
1912
1986
 
1913
1987
  </details>
@@ -1916,7 +1990,7 @@ $ dotenvx set HELLO Dotenvx --no-native
1916
1990
  Encrypt the contents of a `.env` file to an encrypted `.env` file.
1917
1991
 
1918
1992
  ```sh
1919
- $ echo "HELLO=Dotenvx" > .env
1993
+ $ echo "HELLO=World" > .env
1920
1994
 
1921
1995
  $ dotenvx encrypt
1922
1996
  ◈ encrypted (.env) + local key (.env.keys)
@@ -1932,7 +2006,7 @@ Works with unreadable `.env.keys` when `.env` already contains `DOTENV_PUBLIC_KE
1932
2006
  Encrypt the contents of a specified `.env` file to an encrypted `.env` file.
1933
2007
 
1934
2008
  ```sh
1935
- $ echo "HELLO=Dotenvx" > .env
2009
+ $ echo "HELLO=World" > .env
1936
2010
  $ echo "HELLO=Production" > .env.production
1937
2011
 
1938
2012
  $ dotenvx encrypt -f .env.production
@@ -1968,7 +2042,7 @@ Specify path to `.env.keys`. This is useful with monorepos.
1968
2042
 
1969
2043
  ```sh
1970
2044
  $ mkdir -p apps/app1
1971
- $ echo "HELLO=Dotenvx" > apps/app1/.env
2045
+ $ echo "HELLO=World" > apps/app1/.env
1972
2046
 
1973
2047
  $ dotenvx encrypt -fk .env.keys -f apps/app1/.env
1974
2048
  ◈ encrypted (apps/app1/.env)
@@ -1993,7 +2067,7 @@ $ dotenvx run -fk ../../.env.keys -f .env
1993
2067
  Specify the key(s) to encrypt by passing `--key`.
1994
2068
 
1995
2069
  ```sh
1996
- $ echo "HELLO=Dotenvx\nHELLO2=Universe" > .env
2070
+ $ echo "HELLO=World\nHELLO2=Universe" > .env
1997
2071
 
1998
2072
  $ dotenvx encrypt -k HELLO2
1999
2073
  ◈ encrypted (.env)
@@ -2002,7 +2076,7 @@ $ dotenvx encrypt -k HELLO2
2002
2076
  Even specify a glob pattern.
2003
2077
 
2004
2078
  ```sh
2005
- $ echo "HELLO=Dotenvx\nHOLA=Mundo" > .env
2079
+ $ echo "HELLO=World\nHOLA=Mundo" > .env
2006
2080
 
2007
2081
  $ dotenvx encrypt -k "HE*"
2008
2082
  ◈ encrypted (.env)
@@ -2014,7 +2088,7 @@ $ dotenvx encrypt -k "HE*"
2014
2088
  Specify the key(s) to NOT encrypt by passing `--exclude-key`.
2015
2089
 
2016
2090
  ```sh
2017
- $ echo "HELLO=Dotenvx\nHELLO2=Universe" > .env
2091
+ $ echo "HELLO=World\nHELLO2=Universe" > .env
2018
2092
 
2019
2093
  $ dotenvx encrypt -ek HELLO
2020
2094
  ◈ encrypted (.env)
@@ -2023,7 +2097,7 @@ $ dotenvx encrypt -ek HELLO
2023
2097
  Even specify a glob pattern.
2024
2098
 
2025
2099
  ```sh
2026
- $ echo "HELLO=Dotenvx\nHOLA=Mundo" > .env
2100
+ $ echo "HELLO=World\nHOLA=Mundo" > .env
2027
2101
 
2028
2102
  $ dotenvx encrypt -ek "HO*"
2029
2103
  ◈ encrypted (.env)
@@ -2035,7 +2109,7 @@ $ dotenvx encrypt -ek "HO*"
2035
2109
  Skip encryption for keys ending in `_PLAIN`.
2036
2110
 
2037
2111
  ```sh
2038
- $ echo "HELLO=Dotenvx\nHELLO_PLAIN=visible" > .env
2112
+ $ echo "HELLO=World\nHELLO_PLAIN=visible" > .env
2039
2113
 
2040
2114
  $ dotenvx encrypt
2041
2115
  ◈ encrypted (.env)
@@ -2049,7 +2123,7 @@ $ dotenvx encrypt
2049
2123
  Encrypt the contents of a `.env` file and send to stdout.
2050
2124
 
2051
2125
  ```sh
2052
- $ echo "HELLO=Dotenvx" > .env
2126
+ $ echo "HELLO=World" > .env
2053
2127
  $ dotenvx encrypt --stdout
2054
2128
  #/-------------------[DOTENV_PUBLIC_KEY]--------------------/
2055
2129
  #/ public-key encryption for .env files /
@@ -2063,7 +2137,7 @@ HELLO="encrypted:BDqDBibm4wsYqMpCjTQ6BsDHmMadg9K3dAt+Z9HPMfLEIRVz50hmLXPXRuDBXaJ
2063
2137
  or send to a file:
2064
2138
 
2065
2139
  ```sh
2066
- $ echo "HELLO=Dotenvx" > .env
2140
+ $ echo "HELLO=World" > .env
2067
2141
  $ dotenvx encrypt --stdout > somefile.txt
2068
2142
  ```
2069
2143
 
@@ -2073,7 +2147,7 @@ $ dotenvx encrypt --stdout > somefile.txt
2073
2147
  Decrypt the contents of an encrypted `.env` file to an unencrypted `.env` file.
2074
2148
 
2075
2149
  ```sh
2076
- $ echo "HELLO=Dotenvx" > .env
2150
+ $ echo "HELLO=World" > .env
2077
2151
  $ dotenvx encrypt
2078
2152
  ◈ encrypted (.env)
2079
2153
  $ dotenvx decrypt
@@ -2096,7 +2170,7 @@ $ dotenvx decrypt --no-native
2096
2170
  Decrypt the contents of a specified encrypted `.env` file to an unencrypted `.env` file.
2097
2171
 
2098
2172
  ```sh
2099
- $ echo "HELLO=Dotenvx" > .env
2173
+ $ echo "HELLO=World" > .env
2100
2174
  $ echo "HELLO=Production" > .env.production
2101
2175
 
2102
2176
  $ dotenvx encrypt -f .env.production
@@ -2112,7 +2186,7 @@ Specify path to `.env.keys`. This is useful with monorepos.
2112
2186
 
2113
2187
  ```sh
2114
2188
  $ mkdir -p apps/app1
2115
- $ echo "HELLO=Dotenvx" > apps/app1/.env
2189
+ $ echo "HELLO=World" > apps/app1/.env
2116
2190
 
2117
2191
  $ dotenvx encrypt -fk .env.keys -f apps/app1/.env
2118
2192
  ◈ encrypted (apps/app1/.env)
@@ -2126,7 +2200,7 @@ $ dotenvx decrypt -fk .env.keys -f apps/app1/.env
2126
2200
  Decrypt the contents of a specified key inside an encrypted `.env` file.
2127
2201
 
2128
2202
  ```sh
2129
- $ echo "HELLO=Dotenvx\nHOLA=Mundo" > .env
2203
+ $ echo "HELLO=World\nHOLA=Mundo" > .env
2130
2204
  $ dotenvx encrypt
2131
2205
  ◈ encrypted (.env)
2132
2206
  $ dotenvx decrypt -k HELLO
@@ -2136,7 +2210,7 @@ $ dotenvx decrypt -k HELLO
2136
2210
  Even specify a glob pattern.
2137
2211
 
2138
2212
  ```sh
2139
- $ echo "HELLO=Dotenvx\nHOLA=Mundo" > .env
2213
+ $ echo "HELLO=World\nHOLA=Mundo" > .env
2140
2214
  $ dotenvx encrypt
2141
2215
  ◈ encrypted (.env)
2142
2216
  $ dotenvx decrypt -k "HE*"
@@ -2149,7 +2223,7 @@ $ dotenvx decrypt -k "HE*"
2149
2223
  Decrypt the contents inside an encrypted `.env` file except for an excluded key.
2150
2224
 
2151
2225
  ```sh
2152
- $ echo "HELLO=Dotenvx\nHOLA=Mundo" > .env
2226
+ $ echo "HELLO=World\nHOLA=Mundo" > .env
2153
2227
  $ dotenvx encrypt
2154
2228
  ◈ encrypted (.env)
2155
2229
  $ dotenvx decrypt -ek HOLA
@@ -2159,7 +2233,7 @@ $ dotenvx decrypt -ek HOLA
2159
2233
  Even specify a glob pattern.
2160
2234
 
2161
2235
  ```sh
2162
- $ echo "HELLO=Dotenvx\nHOLA=Mundo" > .env
2236
+ $ echo "HELLO=World\nHOLA=Mundo" > .env
2163
2237
  $ dotenvx encrypt
2164
2238
  ◈ encrypted (.env)
2165
2239
  $ dotenvx decrypt -ek "HO*"
@@ -2179,7 +2253,7 @@ $ dotenvx decrypt --stdout
2179
2253
  #/----------------------------------------------------------/
2180
2254
  DOTENV_PUBLIC_KEY="034af93e93708b994c10f236c96ef88e47291066946cce2e8d98c9e02c741ced45"
2181
2255
  # .env
2182
- HELLO="Dotenvx"
2256
+ HELLO="World"
2183
2257
  ```
2184
2258
 
2185
2259
  or send to a file:
@@ -2211,7 +2285,7 @@ Pass a number to control how many characters are visible, such as `--mask 0` to
2211
2285
  Print public/private keys for `.env` file.
2212
2286
 
2213
2287
  ```sh
2214
- $ echo "HELLO=Dotenvx" > .env
2288
+ $ echo "HELLO=World" > .env
2215
2289
  $ dotenvx encrypt
2216
2290
 
2217
2291
  $ dotenvx keypair
@@ -2248,7 +2322,7 @@ Specify path to `.env.keys`. This is useful for printing public/private keys for
2248
2322
 
2249
2323
  ```sh
2250
2324
  $ mkdir -p apps/app1
2251
- $ echo "HELLO=Dotenvx" > apps/app1/.env
2325
+ $ echo "HELLO=World" > apps/app1/.env
2252
2326
  $ dotenvx encrypt -fk .env.keys -f apps/app1/.env
2253
2327
 
2254
2328
  $ dotenvx keypair -fk .env.keys -f apps/app1/.env
@@ -2261,7 +2335,7 @@ $ dotenvx keypair -fk .env.keys -f apps/app1/.env
2261
2335
  Print specific keypair for `.env` file.
2262
2336
 
2263
2337
  ```sh
2264
- $ echo "HELLO=Dotenvx" > .env
2338
+ $ echo "HELLO=World" > .env
2265
2339
  $ dotenvx encrypt
2266
2340
 
2267
2341
  $ dotenvx keypair DOTENV_PRIVATE_KEY
@@ -2274,7 +2348,7 @@ $ dotenvx keypair DOTENV_PRIVATE_KEY
2274
2348
  Print a shell formatted response of public/private keys.
2275
2349
 
2276
2350
  ```sh
2277
- $ echo "HELLO=Dotenvx" > .env
2351
+ $ echo "HELLO=World" > .env
2278
2352
  $ dotenx encrypt
2279
2353
 
2280
2354
  $ dotenvx keypair --format shell
@@ -2374,7 +2448,7 @@ $ dotenvx ls --json > dotenv-files.json
2374
2448
  In one command, generate a `.env.example` file from your current `.env` file contents.
2375
2449
 
2376
2450
  ```sh
2377
- $ echo "HELLO=Dotenvx" > .env
2451
+ $ echo "HELLO=World" > .env
2378
2452
 
2379
2453
  $ dotenvx genexample
2380
2454
  ▣ generated (.env.example)
@@ -2391,7 +2465,7 @@ HELLO=""
2391
2465
  Pass multiple `.env` files to generate your `.env.example` file from the combination of their contents.
2392
2466
 
2393
2467
  ```sh
2394
- $ echo "HELLO=Dotenvx" > .env
2468
+ $ echo "HELLO=World" > .env
2395
2469
  $ echo "DB_HOST=example.com" > .env.production
2396
2470
 
2397
2471
  $ dotenvx genexample -f .env -f .env.production
@@ -2410,7 +2484,7 @@ DB_HOST=""
2410
2484
  Generate a `.env.example` file inside the specified directory. Useful for monorepos.
2411
2485
 
2412
2486
  ```sh
2413
- $ echo "HELLO=Dotenvx" > .env
2487
+ $ echo "HELLO=World" > .env
2414
2488
  $ mkdir -p apps/backend
2415
2489
  $ echo "HELLO=Backend" > apps/backend/.env
2416
2490
 
@@ -2469,7 +2543,7 @@ $ dotenvx precommit --install
2469
2543
  Prevent `.env` files from being committed to code inside a specified path to a directory.
2470
2544
 
2471
2545
  ```sh
2472
- $ echo "HELLO=Dotenvx" > .env
2546
+ $ echo "HELLO=World" > .env
2473
2547
  $ mkdir -p apps/backend
2474
2548
  $ echo "HELLO=Backend" > apps/backend/.env
2475
2549
 
@@ -2774,7 +2848,7 @@ Usage: @dotenvx/dotenvx run [options]
2774
2848
  inject env at runtime [dotenvx run -- yourcommand]
2775
2849
 
2776
2850
  Options:
2777
- -e, --env <strings...> environment variable(s) set as string (example: "HELLO=Dotenvx") (default: [])
2851
+ -e, --env <strings...> environment variable(s) set as string (example: "HELLO=World") (default: [])
2778
2852
  -f, --env-file <paths...> path(s) to your env file(s) (default: [])
2779
2853
  -fv, --env-vault-file <paths...> path(s) to your .env.vault file(s) (default: [])
2780
2854
  -o, --overload override existing env variables
@@ -2790,12 +2864,12 @@ Examples:
2790
2864
 
2791
2865
  Try it:
2792
2866
 
2793
- $ echo "HELLO=Dotenvx" > .env
2867
+ $ echo "HELLO=World" > .env
2794
2868
  $ echo "console.log('Hello ' + process.env.HELLO)" > index.js
2795
2869
 
2796
2870
  $ dotenvx run -- node index.js
2797
2871
  [dotenvx@1.X.X] injecting env (1) from .env
2798
- Hello Dotenvx
2872
+ Hello World
2799
2873
  ```
2800
2874
 
2801
2875
  </details>
@@ -2820,7 +2894,7 @@ Use directly in node.js code.
2820
2894
 
2821
2895
  ```ini
2822
2896
  # .env
2823
- HELLO="Dotenvx"
2897
+ HELLO="World"
2824
2898
  ```
2825
2899
 
2826
2900
  ```js
@@ -2833,7 +2907,7 @@ console.log(`Hello ${process.env.HELLO}`)
2833
2907
  ```sh
2834
2908
  $ node index.js
2835
2909
  [dotenvx@1.X.X] injecting env (1) from .env
2836
- Hello Dotenvx
2910
+ Hello World
2837
2911
  ```
2838
2912
 
2839
2913
  It defaults to looking for a `.env` file.
@@ -2877,7 +2951,7 @@ HELLO="Me"
2877
2951
 
2878
2952
  ```ini
2879
2953
  # .env
2880
- HELLO="Dotenvx"
2954
+ HELLO="World"
2881
2955
  ```
2882
2956
 
2883
2957
  ```js
@@ -2909,7 +2983,7 @@ HELLO="Me"
2909
2983
 
2910
2984
  ```ini
2911
2985
  # .env
2912
- HELLO="Dotenvx"
2986
+ HELLO="World"
2913
2987
  ```
2914
2988
 
2915
2989
  ```js
@@ -2926,7 +3000,7 @@ console.log(`Hello ${process.env.HELLO}`)
2926
3000
  ```sh
2927
3001
  $ node index.js
2928
3002
  [dotenvx@1.X.X] injecting env (1) from .env.local, .env
2929
- Hello Dotenvx
3003
+ Hello World
2930
3004
  ```
2931
3005
 
2932
3006
  </details>
@@ -2936,7 +3010,7 @@ Suppress all output (except errors).
2936
3010
 
2937
3011
  ```ini
2938
3012
  # .env
2939
- HELLO="Dotenvx"
3013
+ HELLO="World"
2940
3014
  ```
2941
3015
 
2942
3016
  ```js
@@ -2953,7 +3027,7 @@ console.log(`Hello ${process.env.HELLO}`)
2953
3027
  ```sh
2954
3028
  $ node index.js
2955
3029
  Error: [MISSING_ENV_FILE] missing .env.missing file (/path/to/.env.missing)
2956
- Hello Dotenvx
3030
+ Hello World
2957
3031
  ```
2958
3032
 
2959
3033
  You can also set `DOTENV_CONFIG_QUIET=true`.
@@ -2961,7 +3035,7 @@ You can also set `DOTENV_CONFIG_QUIET=true`.
2961
3035
  ```sh
2962
3036
  $ DOTENV_CONFIG_QUIET=true node index.js
2963
3037
  Error: [MISSING_ENV_FILE] missing .env.missing file (/path/to/.env.missing)
2964
- Hello Dotenvx
3038
+ Hello World
2965
3039
  ```
2966
3040
 
2967
3041
  </details>
@@ -2971,7 +3045,7 @@ Exit with code `1` if any errors are encountered - like a missing .env file or d
2971
3045
 
2972
3046
  ```ini
2973
3047
  # .env
2974
- HELLO="Dotenvx"
3048
+ HELLO="World"
2975
3049
  ```
2976
3050
 
2977
3051
  ```js
@@ -2997,7 +3071,7 @@ Use `ignore` to suppress specific errors like `MISSING_ENV_FILE`.
2997
3071
 
2998
3072
  ```ini
2999
3073
  # .env
3000
- HELLO="Dotenvx"
3074
+ HELLO="World"
3001
3075
  ```
3002
3076
 
3003
3077
  ```js
@@ -3014,7 +3088,7 @@ console.log(`Hello ${process.env.HELLO}`)
3014
3088
  ```sh
3015
3089
  $ node index.js
3016
3090
  [dotenvx@1.X.X] injecting env (1) from .env
3017
- Hello Dotenvx
3091
+ Hello World
3018
3092
  ```
3019
3093
 
3020
3094
  </details>
@@ -3024,7 +3098,7 @@ Use `envKeysFile` to customize the path to your `.env.keys` file. This is useful
3024
3098
 
3025
3099
  ```ini
3026
3100
  # .env
3027
- HELLO="Dotenvx"
3101
+ HELLO="World"
3028
3102
  ```
3029
3103
 
3030
3104
  ```js
@@ -3110,14 +3184,14 @@ Parse a `.env` string directly in node.js code.
3110
3184
  ```js
3111
3185
  // index.js
3112
3186
  const dotenvx = require('@dotenvx/dotenvx')
3113
- const src = 'HELLO=Dotenvx'
3187
+ const src = 'HELLO=World'
3114
3188
  const parsed = dotenvx.parse(src)
3115
3189
  console.log(`Hello ${parsed.HELLO}`)
3116
3190
  ```
3117
3191
 
3118
3192
  ```sh
3119
3193
  $ node index.js
3120
- Hello Dotenvx
3194
+ Hello World
3121
3195
  ```
3122
3196
 
3123
3197
  </details>
@@ -3146,14 +3220,14 @@ Decrypt an encrypted `.env` string with `privateKey`.
3146
3220
  ```js
3147
3221
  // index.js
3148
3222
  const dotenvx = require('@dotenvx/dotenvx')
3149
- const src = 'HELLO="encrypted:BE9Y7LKANx77X1pv1HnEoil93fPa5c9rpL/1ps48uaRT9zM8VR6mHx9yM+HktKdsPGIZELuZ7rr2mn1gScsmWitppAgE/1lVprNYBCqiYeaTcKXjDUXU5LfsEsflnAsDhT/kWG1l"'
3223
+ const src = 'HELLO="encrypted:BEiK4SwVe4rznIrZKW7qcnEBxo6Qxy0gv8xXiPN90N1jjhwkyVqzgoszZEI00tEeRWHsfQyJbCVy11qOEkkmERWbvOBzHve8/7WmVwyo5Z3HIOhlI45C+zmFgqmS2zMw9GPzHd9e"'
3150
3224
  const parsed = dotenvx.parse(src, { privateKey: 'a4547dcd9d3429615a3649bb79e87edb62ee6a74b007075e9141ae44f5fb412c' })
3151
3225
  console.log(`Hello ${parsed.HELLO}`)
3152
3226
  ```
3153
3227
 
3154
3228
  ```sh
3155
3229
  $ node index.js
3156
- Hello Dotenvx
3230
+ Hello World
3157
3231
  ```
3158
3232
  </details>
3159
3233
  <details><summary>`set(KEY, value)`</summary><br>
@@ -3163,7 +3237,7 @@ Programmatically set an environment variable.
3163
3237
  ```js
3164
3238
  // index.js
3165
3239
  const dotenvx = require('@dotenvx/dotenvx')
3166
- dotenvx.set('HELLO', 'Dotenvx', { path: '.env' })
3240
+ dotenvx.set('HELLO', 'World', { path: '.env' })
3167
3241
  ```
3168
3242
 
3169
3243
  </details>
@@ -3174,7 +3248,7 @@ Programmatically set a plaintext environment variable.
3174
3248
  ```js
3175
3249
  // index.js
3176
3250
  const dotenvx = require('@dotenvx/dotenvx')
3177
- dotenvx.set('HELLO', 'Dotenvx', { plain: true })
3251
+ dotenvx.set('HELLO', 'World', { plain: true })
3178
3252
  ```
3179
3253
 
3180
3254
  </details>
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.11.0",
2
+ "version": "2.11.2",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "a secure dotenv–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "funding": "https://dotenvx.com",
45
45
  "dependencies": {
46
- "@dotenvx/primitives": "^1.8.1",
46
+ "@dotenvx/primitives": "^1.9.0",
47
47
  "@dotenvx/tooling": "^1.0.2",
48
48
  "yocto-spinner": "^1.2.1"
49
49
  },
@@ -13,7 +13,7 @@ const resolveEnvKeysFile = require('../../lib/helpers/resolveEnvKeysFile')
13
13
  const mask = require('../../lib/helpers/mask')
14
14
  const maskEnvSrc = require('../../lib/helpers/maskEnvSrc')
15
15
  const maskProcessedEnvs = require('../../lib/helpers/maskProcessedEnvs')
16
- const decryptedValues = require('../../lib/helpers/decryptedValues')
16
+ const redactedValues = require('../../lib/helpers/redactedValues')
17
17
  const { redactOutput } = require('../../lib/helpers/redactOutput')
18
18
 
19
19
  const { determine } = require('./../../lib/helpers/envResolution')
@@ -127,7 +127,7 @@ async function run () {
127
127
  })
128
128
 
129
129
  if (redactEnabled) {
130
- sensitiveValues = decryptedValues(processedEnvs)
130
+ sensitiveValues = redactedValues(processedEnvs)
131
131
  }
132
132
 
133
133
  if (maskEnabled) {
@@ -64,13 +64,13 @@ program.command('run')
64
64
  .option('-e, --env <strings...>', 'environment variable(s) set as string (example: "HELLO=World")', collectEnvs('env'), [])
65
65
  .option('-f, --env-file <path>', 'path(s) to your env file(s)', collectEnvs('envFile'), [])
66
66
  .option('-fk, --env-keys-file <path>', 'path(s) to your .env.keys file(s) (default: same path as your env file)', collectEnvKeys)
67
+ .option('--redact', 'redact injected values except keys ending in _PLAIN', false)
67
68
  .option('-o, --overload', 'override existing env variables (by default, existing env vars take precedence over .env files)')
68
69
  .option('--strict', 'process.exit(1) on any errors', false)
69
70
  .option('--convention <name>', 'load a .env convention (available conventions: [\'nextjs\', \'flow\'])')
70
71
  .option('--ignore <errorCodes...>', 'error code(s) to ignore (example: --ignore=MISSING_ENV_FILE)')
71
72
  .option('--token <token>', 'set Armor ⛨ token')
72
73
  .option('--mask [characters]', 'inject masked values, optionally setting visible characters')
73
- .option('--redact', 'redact decrypted values from command output', false)
74
74
  .option('--no-armor', 'disable Dotenvx Armor features')
75
75
  .option('--no-native', 'disable OS secret store features')
76
76
  .action(function (...args) {
@@ -4,6 +4,7 @@ const execute = require('./../../lib/helpers/execute')
4
4
  const { logger } = require('./../../shared/logger')
5
5
  const Errors = require('./errors')
6
6
  const { createRedactedStreamWriter, redactOutput } = require('./redactOutput')
7
+ const ptyCommand = require('./ptyCommand')
7
8
 
8
9
  async function executeCommand (commandArgs, env, sensitiveValues = []) {
9
10
  const FORWARD_SIGNAL_GRACE_MS = 1000
@@ -133,8 +134,15 @@ async function executeCommand (commandArgs, env, sensitiveValues = []) {
133
134
 
134
135
  const redactStdout = sensitiveValues.length > 0
135
136
  const redactStderr = sensitiveValues.length > 0
136
-
137
- child = execute.execa(commandArgs[0], commandArgs.slice(1), {
137
+ const usePty = redactStdout && Boolean(
138
+ process.stdin && process.stdin.isTTY &&
139
+ process.stdout && process.stdout.isTTY &&
140
+ process.stderr && process.stderr.isTTY
141
+ )
142
+ const ptyArgs = usePty ? ptyCommand(commandArgs) : null
143
+ const executedArgs = ptyArgs || commandArgs
144
+
145
+ child = execute.execa(executedArgs[0], executedArgs.slice(1), {
138
146
  stdio: ['inherit', redactStdout ? 'pipe' : 'inherit', redactStderr ? 'pipe' : 'inherit'],
139
147
  buffer: false,
140
148
  env: { ...process.env, ...env }
@@ -1,23 +1,5 @@
1
1
  const SAMPLE_ENV_KIT = `
2
- HELLO="Dotenvx"
3
-
4
- # ── Hosting ──────────────────────────────────────
5
- AWS_ACCESS_KEY_ID="xxxx"
6
- AWS_SECRET_ACCESS_KEY="xxxx"
7
- DATABASE_URL="postgresql://postgres:pass@db.ref.supabase.co:5432/postgres"
8
- VERCEL_TOKEN="vcp_xxxx"
9
-
10
- # ── AI ───────────────────────────────────────────
11
- OPENAI_API_KEY="sk-xxxx"
12
- ANTHROPIC_API_KEY="sk-ant-xxxx"
13
-
14
- # ── Infrastructure ───────────────────────────────
15
- AUTH0_CLIENT_ID="xxxx"
16
- AUTH0_CLIENT_SECRET="xxxx"
17
- RESEND_API_KEY="re_xxxx"
18
- STRIPE_API_KEY="sk_test_xxxx"
19
- FLAGSMITH_ENV_ID="xxxx"
20
- SENTRY_DSN="https://hex@o1234.ingest.us.sentry.io/1234567"
2
+ HELLO="World"
21
3
  `.trimStart()
22
4
 
23
5
  module.exports = SAMPLE_ENV_KIT
@@ -0,0 +1,27 @@
1
+ const path = require('path')
2
+ const { which } = require('@dotenvx/tooling')
3
+
4
+ function shellQuote (value) {
5
+ const escapedQuote = ['\'', '"', '\'', '"', '\''].join('')
6
+ return `'${`${value}`.replace(/'/g, escapedQuote)}'`
7
+ }
8
+
9
+ function ptyCommand (commandArgs, platform = process.platform) {
10
+ if (!['darwin', 'linux'].includes(platform)) return null
11
+
12
+ let script
13
+ try {
14
+ script = path.resolve(which.sync('script'))
15
+ } catch (e) {
16
+ return null
17
+ }
18
+
19
+ if (platform === 'darwin') {
20
+ return [script, '-q', '/dev/null', ...commandArgs]
21
+ }
22
+
23
+ // util-linux script only accepts the child command as a shell string.
24
+ return [script, '-qefc', commandArgs.map(shellQuote).join(' '), '/dev/null']
25
+ }
26
+
27
+ module.exports = ptyCommand
@@ -0,0 +1,23 @@
1
+ const isPlainKey = require('./cryptography/isPlainKey')
2
+
3
+ function redactedValues (processedEnvs) {
4
+ const result = new Set()
5
+
6
+ for (const processedEnv of processedEnvs || []) {
7
+ const values = {
8
+ ...(processedEnv.injected || {}),
9
+ ...(processedEnv.existed || {})
10
+ }
11
+
12
+ for (const [key, value] of Object.entries(values)) {
13
+ if (isPlainKey(key)) continue
14
+ if (value === undefined || value === null || value === '') continue
15
+
16
+ result.add(`${value}`)
17
+ }
18
+ }
19
+
20
+ return [...result]
21
+ }
22
+
23
+ module.exports = redactedValues
@@ -1,32 +0,0 @@
1
- const { encrypted, scan } = require('@dotenvx/primitives')
2
-
3
- function decryptedValues (processedEnvs) {
4
- const result = new Set()
5
-
6
- for (const processedEnv of processedEnvs || []) {
7
- const src = processedEnv.src || processedEnv.string
8
- if (!src) continue
9
-
10
- let rawParsed
11
- try {
12
- rawParsed = scan(src).parsed
13
- } catch (error) {
14
- continue
15
- }
16
-
17
- for (const [key, rawValues] of Object.entries(rawParsed || {})) {
18
- const rawValue = rawValues[rawValues.length - 1]
19
- const injectedValue = (processedEnv.injected || {})[key]
20
-
21
- if (!encrypted(rawValue)) continue
22
- if (injectedValue === undefined || injectedValue === null || injectedValue === '') continue
23
- if (encrypted(injectedValue)) continue
24
-
25
- result.add(`${injectedValue}`)
26
- }
27
- }
28
-
29
- return [...result]
30
- }
31
-
32
- module.exports = decryptedValues