@dotenvx/dotenvx 1.59.0 β 1.59.1
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 +7 -1
- package/README.md +116 -133
- package/package.json +1 -1
- package/src/lib/helpers/kits/sample.js +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
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/v1.59.
|
|
5
|
+
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.59.1...main)
|
|
6
|
+
|
|
7
|
+
## [1.59.1](https://github.com/dotenvx/dotenvx/compare/v1.59.0...v1.59.1) (2026-03-28)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
* add `HELLO` key to the kit sample to match most of our examples in the README
|
|
6
12
|
|
|
7
13
|
## [1.59.0](https://github.com/dotenvx/dotenvx/compare/v1.58.0...v1.59.0) (2026-03-28)
|
|
8
14
|
|
package/README.md
CHANGED
|
@@ -109,14 +109,14 @@ dotenvx encrypt
|
|
|
109
109
|
## Run Anywhere
|
|
110
110
|
|
|
111
111
|
```sh
|
|
112
|
-
$ echo "HELLO=
|
|
112
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
113
113
|
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
|
114
114
|
|
|
115
115
|
$ node index.js
|
|
116
116
|
Hello undefined # without dotenvx
|
|
117
117
|
|
|
118
118
|
$ dotenvx run -- node index.js
|
|
119
|
-
Hello
|
|
119
|
+
Hello Dotenvx # with dotenvx
|
|
120
120
|
> :-D
|
|
121
121
|
```
|
|
122
122
|
|
|
@@ -144,24 +144,24 @@ console.log(chalk.blue(`Hello ${process.env.HELLO}`))
|
|
|
144
144
|
|
|
145
145
|
```sh
|
|
146
146
|
$ npm install
|
|
147
|
-
$ echo "HELLO=
|
|
147
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
148
148
|
|
|
149
149
|
$ dotenvx run -- npx tsx index.ts
|
|
150
|
-
Hello
|
|
150
|
+
Hello Dotenvx
|
|
151
151
|
```
|
|
152
152
|
|
|
153
153
|
</details>
|
|
154
154
|
<details><summary>Deno π¦</summary><br>
|
|
155
155
|
|
|
156
156
|
```sh
|
|
157
|
-
$ echo "HELLO=
|
|
157
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
158
158
|
$ echo "console.log('Hello ' + Deno.env.get('HELLO'))" > index.ts
|
|
159
159
|
|
|
160
160
|
$ deno run --allow-env index.ts
|
|
161
161
|
Hello undefined
|
|
162
162
|
|
|
163
163
|
$ dotenvx run -- deno run --allow-env index.ts
|
|
164
|
-
Hello
|
|
164
|
+
Hello Dotenvx
|
|
165
165
|
```
|
|
166
166
|
|
|
167
167
|
> [!WARNING]
|
|
@@ -192,11 +192,11 @@ Hello Test
|
|
|
192
192
|
<details><summary>Python π</summary><br>
|
|
193
193
|
|
|
194
194
|
```sh
|
|
195
|
-
$ echo "HELLO=
|
|
195
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
196
196
|
$ echo 'import os;print("Hello " + os.getenv("HELLO", ""))' > index.py
|
|
197
197
|
|
|
198
198
|
$ dotenvx run -- python3 index.py
|
|
199
|
-
Hello
|
|
199
|
+
Hello Dotenvx
|
|
200
200
|
```
|
|
201
201
|
|
|
202
202
|
see [extended python guide](https://dotenvx.com/docs/quickstart)
|
|
@@ -205,11 +205,11 @@ see [extended python guide](https://dotenvx.com/docs/quickstart)
|
|
|
205
205
|
<details><summary>PHP π</summary><br>
|
|
206
206
|
|
|
207
207
|
```sh
|
|
208
|
-
$ echo "HELLO=
|
|
208
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
209
209
|
$ echo '<?php echo "Hello {$_SERVER["HELLO"]}\n";' > index.php
|
|
210
210
|
|
|
211
211
|
$ dotenvx run -- php index.php
|
|
212
|
-
Hello
|
|
212
|
+
Hello Dotenvx
|
|
213
213
|
```
|
|
214
214
|
|
|
215
215
|
see [extended php guide](https://dotenvx.com/docs/quickstart)
|
|
@@ -218,11 +218,11 @@ see [extended php guide](https://dotenvx.com/docs/quickstart)
|
|
|
218
218
|
<details><summary>Ruby π</summary><br>
|
|
219
219
|
|
|
220
220
|
```sh
|
|
221
|
-
$ echo "HELLO=
|
|
221
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
222
222
|
$ echo 'puts "Hello #{ENV["HELLO"]}"' > index.rb
|
|
223
223
|
|
|
224
224
|
$ dotenvx run -- ruby index.rb
|
|
225
|
-
Hello
|
|
225
|
+
Hello Dotenvx
|
|
226
226
|
```
|
|
227
227
|
|
|
228
228
|
see [extended ruby guide](https://dotenvx.com/docs/quickstart)
|
|
@@ -231,11 +231,11 @@ see [extended ruby guide](https://dotenvx.com/docs/quickstart)
|
|
|
231
231
|
<details><summary>Go πΉ</summary><br>
|
|
232
232
|
|
|
233
233
|
```sh
|
|
234
|
-
$ echo "HELLO=
|
|
234
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
235
235
|
$ echo 'package main; import ("fmt"; "os"); func main() { fmt.Printf("Hello %s\n", os.Getenv("HELLO")) }' > main.go
|
|
236
236
|
|
|
237
237
|
$ dotenvx run -- go run main.go
|
|
238
|
-
Hello
|
|
238
|
+
Hello Dotenvx
|
|
239
239
|
```
|
|
240
240
|
|
|
241
241
|
see [extended go guide](https://dotenvx.com/docs/quickstart)
|
|
@@ -244,11 +244,11 @@ see [extended go guide](https://dotenvx.com/docs/quickstart)
|
|
|
244
244
|
<details><summary>Rust π¦</summary><br>
|
|
245
245
|
|
|
246
246
|
```sh
|
|
247
|
-
$ echo "HELLO=
|
|
247
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
248
248
|
$ echo 'fn main() {let hello = std::env::var("HELLO").unwrap_or("".to_string());println!("Hello {hello}");}' > src/main.rs
|
|
249
249
|
|
|
250
250
|
$ dotenvx run -- cargo run
|
|
251
|
-
Hello
|
|
251
|
+
Hello Dotenvx
|
|
252
252
|
```
|
|
253
253
|
|
|
254
254
|
see [extended rust guide](https://dotenvx.com/docs/quickstart)
|
|
@@ -257,34 +257,34 @@ see [extended rust guide](https://dotenvx.com/docs/quickstart)
|
|
|
257
257
|
<details><summary>Java βοΈ</summary><br>
|
|
258
258
|
|
|
259
259
|
```sh
|
|
260
|
-
$ echo "HELLO=
|
|
260
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
261
261
|
$ echo 'public class Index { public static void main(String[] args) { System.out.println("Hello " + System.getenv("HELLO")); } }' > index.java
|
|
262
262
|
|
|
263
263
|
$ dotenvx run -- java index.java
|
|
264
|
-
Hello
|
|
264
|
+
Hello Dotenvx
|
|
265
265
|
```
|
|
266
266
|
|
|
267
267
|
</details>
|
|
268
268
|
<details><summary>Clojure πΏ</summary><br>
|
|
269
269
|
|
|
270
270
|
```sh
|
|
271
|
-
$ echo "HELLO=
|
|
271
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
272
272
|
$ echo '(println "Hello" (System/getenv "HELLO"))' > index.clj
|
|
273
273
|
|
|
274
274
|
$ dotenvx run -- clojure -M index.clj
|
|
275
|
-
Hello
|
|
275
|
+
Hello Dotenvx
|
|
276
276
|
```
|
|
277
277
|
|
|
278
278
|
</details>
|
|
279
279
|
<details><summary>Kotlin π</summary><br>
|
|
280
280
|
|
|
281
281
|
```sh
|
|
282
|
-
$ echo "HELLO=
|
|
282
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
283
283
|
$ echo 'fun main() { val hello = System.getenv("HELLO") ?: ""; println("Hello $hello") }' > index.kt
|
|
284
284
|
$ kotlinc index.kt -include-runtime -d index.jar
|
|
285
285
|
|
|
286
286
|
$ dotenvx run -- java -jar index.jar
|
|
287
|
-
Hello
|
|
287
|
+
Hello Dotenvx
|
|
288
288
|
```
|
|
289
289
|
|
|
290
290
|
</details>
|
|
@@ -293,31 +293,31 @@ Hello World
|
|
|
293
293
|
```sh
|
|
294
294
|
$ dotnet new console -n HelloWorld -o HelloWorld
|
|
295
295
|
$ cd HelloWorld
|
|
296
|
-
$ echo "HELLO=
|
|
296
|
+
$ echo "HELLO=Dotenvx" | Out-File -FilePath .env -Encoding utf8
|
|
297
297
|
$ echo 'Console.WriteLine($"Hello {Environment.GetEnvironmentVariable("HELLO")}");' > Program.cs
|
|
298
298
|
|
|
299
299
|
$ dotenvx run -- dotnet run
|
|
300
|
-
Hello
|
|
300
|
+
Hello Dotenvx
|
|
301
301
|
```
|
|
302
302
|
|
|
303
303
|
</details>
|
|
304
304
|
<details><summary>Bash π₯οΈ</summary><br>
|
|
305
305
|
|
|
306
306
|
```sh
|
|
307
|
-
$ echo "HELLO=
|
|
307
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
308
308
|
|
|
309
309
|
$ dotenvx run --quiet -- sh -c 'echo Hello $HELLO'
|
|
310
|
-
Hello
|
|
310
|
+
Hello Dotenvx
|
|
311
311
|
```
|
|
312
312
|
|
|
313
313
|
</details>
|
|
314
314
|
<details><summary>Fish π </summary><br>
|
|
315
315
|
|
|
316
316
|
```sh
|
|
317
|
-
$ echo "HELLO=
|
|
317
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
318
318
|
|
|
319
319
|
$ dotenvx run --quiet -- sh -c 'echo Hello $HELLO'
|
|
320
|
-
Hello
|
|
320
|
+
Hello Dotenvx
|
|
321
321
|
```
|
|
322
322
|
|
|
323
323
|
</details>
|
|
@@ -351,7 +351,7 @@ Or in any image:
|
|
|
351
351
|
|
|
352
352
|
```sh
|
|
353
353
|
FROM node:latest
|
|
354
|
-
RUN echo "HELLO=
|
|
354
|
+
RUN echo "HELLO=Dotenvx" > .env && echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
|
355
355
|
RUN curl -fsS https://dotenvx.sh/install.sh | sh
|
|
356
356
|
CMD ["dotenvx", "run", "--", "echo", "Hello $HELLO"]
|
|
357
357
|
```
|
|
@@ -443,7 +443,7 @@ $ npm run start
|
|
|
443
443
|
> ./node_modules/.bin/dotenvx run -- node index.js
|
|
444
444
|
|
|
445
445
|
[dotenvx@1.X.X] injecting env (1) from .env.production
|
|
446
|
-
Hello
|
|
446
|
+
Hello Dotenvx
|
|
447
447
|
```
|
|
448
448
|
|
|
449
449
|
</details>
|
|
@@ -531,7 +531,7 @@ More examples
|
|
|
531
531
|
```sh
|
|
532
532
|
$ echo "HELLO=local" > .env.local
|
|
533
533
|
|
|
534
|
-
$ echo "HELLO=
|
|
534
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
535
535
|
|
|
536
536
|
$ dotenvx run -f .env.local -f .env -- node index.js
|
|
537
537
|
[dotenvx@1.X.X] injecting env (1) from .env.local,.env
|
|
@@ -547,11 +547,11 @@ Note subsequent files do NOT override pre-existing variables defined in previous
|
|
|
547
547
|
```sh
|
|
548
548
|
$ echo "HELLO=local" > .env.local
|
|
549
549
|
|
|
550
|
-
$ echo "HELLO=
|
|
550
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
551
551
|
|
|
552
552
|
$ dotenvx run -f .env.local -f .env --overload -- node index.js
|
|
553
553
|
[dotenvx@1.X.X] injecting env (1) from .env.local,.env
|
|
554
|
-
Hello
|
|
554
|
+
Hello Dotenvx
|
|
555
555
|
```
|
|
556
556
|
|
|
557
557
|
Note that with `--overload` subsequent files DO override pre-existing variables defined in previous files.
|
|
@@ -656,13 +656,13 @@ More examples
|
|
|
656
656
|
<details><summary>`.env`</summary><br>
|
|
657
657
|
|
|
658
658
|
```sh
|
|
659
|
-
$ echo "HELLO=
|
|
659
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
660
660
|
$ dotenvx encrypt
|
|
661
661
|
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
|
662
662
|
|
|
663
663
|
$ dotenvx run -- node index.js
|
|
664
664
|
[dotenvx@1.X.X] injecting env (2) from .env
|
|
665
|
-
Hello
|
|
665
|
+
Hello Dotenvx
|
|
666
666
|
```
|
|
667
667
|
|
|
668
668
|
</details>
|
|
@@ -699,13 +699,13 @@ Note the `DOTENV_PRIVATE_KEY_CI` ends with `_CI`. This instructs `dotenvx run` t
|
|
|
699
699
|
<details><summary>combine multiple encrypted .env files</summary><br>
|
|
700
700
|
|
|
701
701
|
```sh
|
|
702
|
-
$ dotenvx set HELLO
|
|
702
|
+
$ dotenvx set HELLO Dotenvx -f .env
|
|
703
703
|
$ dotenvx set HELLO Production -f .env.production
|
|
704
704
|
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
|
705
705
|
|
|
706
706
|
$ DOTENV_PRIVATE_KEY="<.env private key>" DOTENV_PRIVATE_KEY_PRODUCTION="<.env.production private key>" dotenvx run -- node index.js
|
|
707
707
|
[dotenvx@1.X.X] injecting env (3) from .env, .env.production
|
|
708
|
-
Hello
|
|
708
|
+
Hello Dotenvx
|
|
709
709
|
```
|
|
710
710
|
|
|
711
711
|
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?
|
|
@@ -735,7 +735,7 @@ Note the `DOTENV_PRIVATE_KEY_CI` (and any `DOTENV_PRIVATE_KEY*`) can take multip
|
|
|
735
735
|
<details><summary>`--stdout`</summary><br>
|
|
736
736
|
|
|
737
737
|
```sh
|
|
738
|
-
$ echo "HELLO=
|
|
738
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
739
739
|
$ dotenvx encrypt --stdout
|
|
740
740
|
$ dotenvx encrypt --stdout > .env.encrypted
|
|
741
741
|
```
|
|
@@ -903,8 +903,8 @@ DATABASE_URL postgres://yourusername@localhost/my_database
|
|
|
903
903
|
Prevent your shell from expanding inline `$VARIABLES` before dotenvx has a chance to inject it. Use a subshell.
|
|
904
904
|
|
|
905
905
|
```sh
|
|
906
|
-
$ dotenvx run --env="HELLO=
|
|
907
|
-
Hello
|
|
906
|
+
$ dotenvx run --env="HELLO=Dotenvx" -- sh -c 'echo Hello $HELLO'
|
|
907
|
+
Hello Dotenvx
|
|
908
908
|
```
|
|
909
909
|
|
|
910
910
|
</details>
|
|
@@ -948,13 +948,13 @@ For example, when missing a custom .env file:
|
|
|
948
948
|
|
|
949
949
|
```sh
|
|
950
950
|
$ dotenvx run -f .env.missing -- echo $HELLO
|
|
951
|
-
[MISSING_ENV_FILE] missing file (/Users/scottmotte/Code/dotenvx/playground/apr-16/.env.missing). fix: [echo "HELLO=
|
|
951
|
+
[MISSING_ENV_FILE] missing file (/Users/scottmotte/Code/dotenvx/playground/apr-16/.env.missing). fix: [echo "HELLO=Dotenvx" > .env.missing]
|
|
952
952
|
```
|
|
953
953
|
|
|
954
954
|
or when missing a KEY:
|
|
955
955
|
|
|
956
956
|
```sh
|
|
957
|
-
$ echo "HELLO=
|
|
957
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
958
958
|
$ dotenvx get GOODBYE
|
|
959
959
|
[MISSING_KEY] missing key (GOODBYE)
|
|
960
960
|
```
|
|
@@ -966,7 +966,7 @@ Compose multiple `.env` files for environment variables loading, as you need.
|
|
|
966
966
|
|
|
967
967
|
```sh
|
|
968
968
|
$ echo "HELLO=local" > .env.local
|
|
969
|
-
$ echo "HELLO=
|
|
969
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
970
970
|
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
|
971
971
|
|
|
972
972
|
$ dotenvx run -f .env.local -f .env -- node index.js
|
|
@@ -982,7 +982,7 @@ Note subsequent files do NOT override pre-existing variables defined in previous
|
|
|
982
982
|
Set environment variables as a simple `KEY=value` string pair.
|
|
983
983
|
|
|
984
984
|
```sh
|
|
985
|
-
$ echo "HELLO=
|
|
985
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
986
986
|
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
|
987
987
|
|
|
988
988
|
$ dotenvx run --env HELLO=String -f .env -- node index.js
|
|
@@ -997,12 +997,12 @@ Override existing env variables. These can be variables already on your machine
|
|
|
997
997
|
|
|
998
998
|
```sh
|
|
999
999
|
$ echo "HELLO=local" > .env.local
|
|
1000
|
-
$ echo "HELLO=
|
|
1000
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1001
1001
|
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
|
1002
1002
|
|
|
1003
1003
|
$ dotenvx run -f .env.local -f .env --overload -- node index.js
|
|
1004
1004
|
[dotenvx@1.X.X] injecting env (1) from .env.local, .env
|
|
1005
|
-
Hello
|
|
1005
|
+
Hello Dotenvx
|
|
1006
1006
|
```
|
|
1007
1007
|
|
|
1008
1008
|
Note that with `--overload` subsequent files DO override pre-existing variables defined in previous files.
|
|
@@ -1183,7 +1183,7 @@ Exit with code `1` if any errors are encountered - like a missing .env file or d
|
|
|
1183
1183
|
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
|
1184
1184
|
|
|
1185
1185
|
$ dotenvx run -f .env.missing --strict -- node index.js
|
|
1186
|
-
[MISSING_ENV_FILE] missing file (/path/to/.env.missing). fix: [echo "HELLO=
|
|
1186
|
+
[MISSING_ENV_FILE] missing file (/path/to/.env.missing). fix: [echo "HELLO=Dotenvx" > .env.missing]
|
|
1187
1187
|
```
|
|
1188
1188
|
|
|
1189
1189
|
This can be useful in `ci` scripts where you want to fail the ci if your `.env` file could not be decrypted at runtime.
|
|
@@ -1252,7 +1252,7 @@ Specify path to `.env.keys`. This is useful with monorepos.
|
|
|
1252
1252
|
```sh
|
|
1253
1253
|
$ mkdir -p apps/app1
|
|
1254
1254
|
$ touch apps/app1/.env
|
|
1255
|
-
$ dotenvx set HELLO
|
|
1255
|
+
$ dotenvx set HELLO Dotenvx -fk .env.keys -f apps/app1/.env
|
|
1256
1256
|
|
|
1257
1257
|
$ dotenvx run -fk .env.keys -f apps/app1/.env -- yourcommand
|
|
1258
1258
|
```
|
|
@@ -1272,7 +1272,7 @@ $ dotenvx run --ops-off -- yourcommand
|
|
|
1272
1272
|
Return a single environment variable's value.
|
|
1273
1273
|
|
|
1274
1274
|
```sh
|
|
1275
|
-
$ echo "HELLO=
|
|
1275
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1276
1276
|
|
|
1277
1277
|
$ dotenvx get HELLO
|
|
1278
1278
|
World
|
|
@@ -1284,7 +1284,7 @@ World
|
|
|
1284
1284
|
Return a single environment variable's value from a specific `.env` file.
|
|
1285
1285
|
|
|
1286
1286
|
```sh
|
|
1287
|
-
$ echo "HELLO=
|
|
1287
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1288
1288
|
$ echo "HELLO=production" > .env.production
|
|
1289
1289
|
|
|
1290
1290
|
$ dotenvx get HELLO -f .env.production
|
|
@@ -1299,7 +1299,7 @@ Specify path to `.env.keys`. This is useful with monorepos.
|
|
|
1299
1299
|
```sh
|
|
1300
1300
|
$ mkdir -p apps/app1
|
|
1301
1301
|
$ touch apps/app1/.env
|
|
1302
|
-
$ dotenvx set HELLO
|
|
1302
|
+
$ dotenvx set HELLO Dotenvx -fk .env.keys -f apps/app1/.env
|
|
1303
1303
|
|
|
1304
1304
|
$ dotenvx get HELLO -fk .env.keys -f apps/app1/.env
|
|
1305
1305
|
world
|
|
@@ -1322,7 +1322,7 @@ String
|
|
|
1322
1322
|
Return a single environment variable's value where each found value is overloaded.
|
|
1323
1323
|
|
|
1324
1324
|
```sh
|
|
1325
|
-
$ echo "HELLO=
|
|
1325
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1326
1326
|
$ echo "HELLO=production" > .env.production
|
|
1327
1327
|
|
|
1328
1328
|
$ dotenvx get HELLO -f .env.production --env HELLO=String -f .env --overload
|
|
@@ -1384,10 +1384,10 @@ development local
|
|
|
1384
1384
|
Return a json response of all key/value pairs in a `.env` file.
|
|
1385
1385
|
|
|
1386
1386
|
```sh
|
|
1387
|
-
$ echo "HELLO=
|
|
1387
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1388
1388
|
|
|
1389
1389
|
$ dotenvx get
|
|
1390
|
-
{"HELLO":"
|
|
1390
|
+
{"HELLO":"Dotenvx"}
|
|
1391
1391
|
```
|
|
1392
1392
|
|
|
1393
1393
|
</details>
|
|
@@ -1396,11 +1396,11 @@ $ dotenvx get
|
|
|
1396
1396
|
Return a shell formatted response of all key/value pairs in a `.env` file.
|
|
1397
1397
|
|
|
1398
1398
|
```sh
|
|
1399
|
-
$ echo "HELLO=
|
|
1399
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1400
1400
|
$ echo "KEY=value" >> .env
|
|
1401
1401
|
|
|
1402
1402
|
$ dotenvx get --format shell
|
|
1403
|
-
HELLO=
|
|
1403
|
+
HELLO=Dotenvx KEY=value
|
|
1404
1404
|
```
|
|
1405
1405
|
|
|
1406
1406
|
This can be useful when combined with `env` on the command line.
|
|
@@ -1426,11 +1426,11 @@ Hello value World
|
|
|
1426
1426
|
Return an `eval`-ready shell formatted response of all key/value pairs in a `.env` file.
|
|
1427
1427
|
|
|
1428
1428
|
```sh
|
|
1429
|
-
$ echo "HELLO=
|
|
1429
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1430
1430
|
$ echo "KEY=value" >> .env
|
|
1431
1431
|
|
|
1432
1432
|
$ dotenvx get --format eval
|
|
1433
|
-
HELLO="
|
|
1433
|
+
HELLO="Dotenvx"
|
|
1434
1434
|
KEY="value"
|
|
1435
1435
|
```
|
|
1436
1436
|
|
|
@@ -1453,10 +1453,10 @@ Be careful with `eval` as it allows for arbitrary execution of commands. Prefer
|
|
|
1453
1453
|
Return preset machine envs as well.
|
|
1454
1454
|
|
|
1455
1455
|
```sh
|
|
1456
|
-
$ echo "HELLO=
|
|
1456
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1457
1457
|
|
|
1458
1458
|
$ dotenvx get --all
|
|
1459
|
-
{"PWD":"/some/file/path","USER":"username","LIBRARY_PATH":"/usr/local/lib", ..., "HELLO":"
|
|
1459
|
+
{"PWD":"/some/file/path","USER":"username","LIBRARY_PATH":"/usr/local/lib", ..., "HELLO":"Dotenvx"}
|
|
1460
1460
|
```
|
|
1461
1461
|
|
|
1462
1462
|
</details>
|
|
@@ -1465,7 +1465,7 @@ $ dotenvx get --all
|
|
|
1465
1465
|
Make the output more readable - pretty print it.
|
|
1466
1466
|
|
|
1467
1467
|
```sh
|
|
1468
|
-
$ echo "HELLO=
|
|
1468
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1469
1469
|
|
|
1470
1470
|
$ dotenvx get --all --pretty-print
|
|
1471
1471
|
{
|
|
@@ -1473,7 +1473,7 @@ $ dotenvx get --all --pretty-print
|
|
|
1473
1473
|
"USER": "username",
|
|
1474
1474
|
"LIBRARY_PATH": "/usr/local/lib",
|
|
1475
1475
|
...,
|
|
1476
|
-
"HELLO": "
|
|
1476
|
+
"HELLO": "Dotenvx"
|
|
1477
1477
|
}
|
|
1478
1478
|
```
|
|
1479
1479
|
|
|
@@ -1485,7 +1485,7 @@ Set an encrypted key/value (on by default).
|
|
|
1485
1485
|
```sh
|
|
1486
1486
|
$ touch .env
|
|
1487
1487
|
|
|
1488
|
-
$ dotenvx set HELLO
|
|
1488
|
+
$ dotenvx set HELLO Dotenvx
|
|
1489
1489
|
set HELLO with encryption (.env)
|
|
1490
1490
|
```
|
|
1491
1491
|
|
|
@@ -1510,7 +1510,7 @@ Specify path to `.env.keys`. This is useful with monorepos.
|
|
|
1510
1510
|
$ mkdir -p apps/app1
|
|
1511
1511
|
$ touch apps/app1/.env
|
|
1512
1512
|
|
|
1513
|
-
$ dotenvx set HELLO
|
|
1513
|
+
$ dotenvx set HELLO Dotenvx -fk .env.keys -f apps/app1/.env
|
|
1514
1514
|
set HELLO with encryption (.env)
|
|
1515
1515
|
```
|
|
1516
1516
|
|
|
@@ -1559,7 +1559,7 @@ Set a plaintext key/value.
|
|
|
1559
1559
|
```sh
|
|
1560
1560
|
$ touch .env
|
|
1561
1561
|
|
|
1562
|
-
$ dotenvx set HELLO
|
|
1562
|
+
$ dotenvx set HELLO Dotenvx --plain
|
|
1563
1563
|
set HELLO (.env)
|
|
1564
1564
|
```
|
|
1565
1565
|
|
|
@@ -1569,7 +1569,7 @@ set HELLO (.env)
|
|
|
1569
1569
|
Encrypt the contents of a `.env` file to an encrypted `.env` file.
|
|
1570
1570
|
|
|
1571
1571
|
```sh
|
|
1572
|
-
$ echo "HELLO=
|
|
1572
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1573
1573
|
|
|
1574
1574
|
$ dotenvx encrypt
|
|
1575
1575
|
β encrypted (.env) + key (.env.keys)
|
|
@@ -1583,7 +1583,7 @@ $ dotenvx encrypt
|
|
|
1583
1583
|
Encrypt the contents of a specified `.env` file to an encrypted `.env` file.
|
|
1584
1584
|
|
|
1585
1585
|
```sh
|
|
1586
|
-
$ echo "HELLO=
|
|
1586
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1587
1587
|
$ echo "HELLO=Production" > .env.production
|
|
1588
1588
|
|
|
1589
1589
|
$ dotenvx encrypt -f .env.production
|
|
@@ -1599,7 +1599,7 @@ Specify path to `.env.keys`. This is useful with monorepos.
|
|
|
1599
1599
|
|
|
1600
1600
|
```sh
|
|
1601
1601
|
$ mkdir -p apps/app1
|
|
1602
|
-
$ echo "HELLO=
|
|
1602
|
+
$ echo "HELLO=Dotenvx" > apps/app1/.env
|
|
1603
1603
|
|
|
1604
1604
|
$ dotenvx encrypt -fk .env.keys -f apps/app1/.env
|
|
1605
1605
|
β encrypted (apps/app1/.env)
|
|
@@ -1624,7 +1624,7 @@ $ dotenvx run -fk ../../.env.keys -f .env
|
|
|
1624
1624
|
Specify the key(s) to encrypt by passing `--key`.
|
|
1625
1625
|
|
|
1626
1626
|
```sh
|
|
1627
|
-
$ echo "HELLO=
|
|
1627
|
+
$ echo "HELLO=Dotenvx\nHELLO2=Universe" > .env
|
|
1628
1628
|
|
|
1629
1629
|
$ dotenvx encrypt -k HELLO2
|
|
1630
1630
|
β encrypted (.env)
|
|
@@ -1633,7 +1633,7 @@ $ dotenvx encrypt -k HELLO2
|
|
|
1633
1633
|
Even specify a glob pattern.
|
|
1634
1634
|
|
|
1635
1635
|
```sh
|
|
1636
|
-
$ echo "HELLO=
|
|
1636
|
+
$ echo "HELLO=Dotenvx\nHOLA=Mundo" > .env
|
|
1637
1637
|
|
|
1638
1638
|
$ dotenvx encrypt -k "HE*"
|
|
1639
1639
|
β encrypted (.env)
|
|
@@ -1645,7 +1645,7 @@ $ dotenvx encrypt -k "HE*"
|
|
|
1645
1645
|
Specify the key(s) to NOT encrypt by passing `--exclude-key`.
|
|
1646
1646
|
|
|
1647
1647
|
```sh
|
|
1648
|
-
$ echo "HELLO=
|
|
1648
|
+
$ echo "HELLO=Dotenvx\nHELLO2=Universe" > .env
|
|
1649
1649
|
|
|
1650
1650
|
$ dotenvx encrypt -ek HELLO
|
|
1651
1651
|
β encrypted (.env)
|
|
@@ -1654,7 +1654,7 @@ $ dotenvx encrypt -ek HELLO
|
|
|
1654
1654
|
Even specify a glob pattern.
|
|
1655
1655
|
|
|
1656
1656
|
```sh
|
|
1657
|
-
$ echo "HELLO=
|
|
1657
|
+
$ echo "HELLO=Dotenvx\nHOLA=Mundo" > .env
|
|
1658
1658
|
|
|
1659
1659
|
$ dotenvx encrypt -ek "HO*"
|
|
1660
1660
|
β encrypted (.env)
|
|
@@ -1666,7 +1666,7 @@ $ dotenvx encrypt -ek "HO*"
|
|
|
1666
1666
|
Encrypt the contents of a `.env` file and send to stdout.
|
|
1667
1667
|
|
|
1668
1668
|
```sh
|
|
1669
|
-
$ echo "HELLO=
|
|
1669
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1670
1670
|
$ dotenvx encrypt --stdout
|
|
1671
1671
|
#/-------------------[DOTENV_PUBLIC_KEY]--------------------/
|
|
1672
1672
|
#/ public-key encryption for .env files /
|
|
@@ -1680,7 +1680,7 @@ HELLO="encrypted:BDqDBibm4wsYqMpCjTQ6BsDHmMadg9K3dAt+Z9HPMfLEIRVz50hmLXPXRuDBXaJ
|
|
|
1680
1680
|
or send to a file:
|
|
1681
1681
|
|
|
1682
1682
|
```sh
|
|
1683
|
-
$ echo "HELLO=
|
|
1683
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1684
1684
|
$ dotenvx encrypt --stdout > somefile.txt
|
|
1685
1685
|
```
|
|
1686
1686
|
|
|
@@ -1690,7 +1690,7 @@ $ dotenvx encrypt --stdout > somefile.txt
|
|
|
1690
1690
|
Decrypt the contents of an encrypted `.env` file to an unencrypted `.env` file.
|
|
1691
1691
|
|
|
1692
1692
|
```sh
|
|
1693
|
-
$ echo "HELLO=
|
|
1693
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1694
1694
|
$ dotenvx encrypt
|
|
1695
1695
|
β encrypted (.env)
|
|
1696
1696
|
$ dotenvx decrypt
|
|
@@ -1703,7 +1703,7 @@ $ dotenvx decrypt
|
|
|
1703
1703
|
Decrypt the contents of a specified encrypted `.env` file to an unencrypted `.env` file.
|
|
1704
1704
|
|
|
1705
1705
|
```sh
|
|
1706
|
-
$ echo "HELLO=
|
|
1706
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1707
1707
|
$ echo "HELLO=Production" > .env.production
|
|
1708
1708
|
|
|
1709
1709
|
$ dotenvx encrypt -f .env.production
|
|
@@ -1719,7 +1719,7 @@ Specify path to `.env.keys`. This is useful with monorepos.
|
|
|
1719
1719
|
|
|
1720
1720
|
```sh
|
|
1721
1721
|
$ mkdir -p apps/app1
|
|
1722
|
-
$ echo "HELLO=
|
|
1722
|
+
$ echo "HELLO=Dotenvx" > apps/app1/.env
|
|
1723
1723
|
|
|
1724
1724
|
$ dotenvx encrypt -fk .env.keys -f apps/app1/.env
|
|
1725
1725
|
β encrypted (apps/app1/.env)
|
|
@@ -1733,7 +1733,7 @@ $ dotenvx decrypt -fk .env.keys -f apps/app1/.env
|
|
|
1733
1733
|
Decrypt the contents of a specified key inside an encrypted `.env` file.
|
|
1734
1734
|
|
|
1735
1735
|
```sh
|
|
1736
|
-
$ echo "HELLO=
|
|
1736
|
+
$ echo "HELLO=Dotenvx\nHOLA=Mundo" > .env
|
|
1737
1737
|
$ dotenvx encrypt
|
|
1738
1738
|
β encrypted (.env)
|
|
1739
1739
|
$ dotenvx decrypt -k HELLO
|
|
@@ -1743,7 +1743,7 @@ $ dotenvx decrypt -k HELLO
|
|
|
1743
1743
|
Even specify a glob pattern.
|
|
1744
1744
|
|
|
1745
1745
|
```sh
|
|
1746
|
-
$ echo "HELLO=
|
|
1746
|
+
$ echo "HELLO=Dotenvx\nHOLA=Mundo" > .env
|
|
1747
1747
|
$ dotenvx encrypt
|
|
1748
1748
|
β encrypted (.env)
|
|
1749
1749
|
$ dotenvx decrypt -k "HE*"
|
|
@@ -1756,7 +1756,7 @@ $ dotenvx decrypt -k "HE*"
|
|
|
1756
1756
|
Decrypt the contents inside an encrypted `.env` file except for an excluded key.
|
|
1757
1757
|
|
|
1758
1758
|
```sh
|
|
1759
|
-
$ echo "HELLO=
|
|
1759
|
+
$ echo "HELLO=Dotenvx\nHOLA=Mundo" > .env
|
|
1760
1760
|
$ dotenvx encrypt
|
|
1761
1761
|
β encrypted (.env)
|
|
1762
1762
|
$ dotenvx decrypt -ek HOLA
|
|
@@ -1766,7 +1766,7 @@ $ dotenvx decrypt -ek HOLA
|
|
|
1766
1766
|
Even specify a glob pattern.
|
|
1767
1767
|
|
|
1768
1768
|
```sh
|
|
1769
|
-
$ echo "HELLO=
|
|
1769
|
+
$ echo "HELLO=Dotenvx\nHOLA=Mundo" > .env
|
|
1770
1770
|
$ dotenvx encrypt
|
|
1771
1771
|
β encrypted (.env)
|
|
1772
1772
|
$ dotenvx decrypt -ek "HO*"
|
|
@@ -1786,7 +1786,7 @@ $ dotenvx decrypt --stdout
|
|
|
1786
1786
|
#/----------------------------------------------------------/
|
|
1787
1787
|
DOTENV_PUBLIC_KEY="034af93e93708b994c10f236c96ef88e47291066946cce2e8d98c9e02c741ced45"
|
|
1788
1788
|
# .env
|
|
1789
|
-
HELLO="
|
|
1789
|
+
HELLO="Dotenvx"
|
|
1790
1790
|
```
|
|
1791
1791
|
|
|
1792
1792
|
or send to a file:
|
|
@@ -1801,7 +1801,7 @@ $ dotenvx decrypt --stdout > somefile.txt
|
|
|
1801
1801
|
Print public/private keys for `.env` file.
|
|
1802
1802
|
|
|
1803
1803
|
```sh
|
|
1804
|
-
$ echo "HELLO=
|
|
1804
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1805
1805
|
$ dotenvx encrypt
|
|
1806
1806
|
|
|
1807
1807
|
$ dotenvx keypair
|
|
@@ -1828,7 +1828,7 @@ Specify path to `.env.keys`. This is useful for printing public/private keys for
|
|
|
1828
1828
|
|
|
1829
1829
|
```sh
|
|
1830
1830
|
$ mkdir -p apps/app1
|
|
1831
|
-
$ echo "HELLO=
|
|
1831
|
+
$ echo "HELLO=Dotenvx" > apps/app1/.env
|
|
1832
1832
|
$ dotenvx encrypt -fk .env.keys -f apps/app1/.env
|
|
1833
1833
|
|
|
1834
1834
|
$ dotenvx keypair -fk .env.keys -f apps/app1/.env
|
|
@@ -1841,7 +1841,7 @@ $ dotenvx keypair -fk .env.keys -f apps/app1/.env
|
|
|
1841
1841
|
Print specific keypair for `.env` file.
|
|
1842
1842
|
|
|
1843
1843
|
```sh
|
|
1844
|
-
$ echo "HELLO=
|
|
1844
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1845
1845
|
$ dotenvx encrypt
|
|
1846
1846
|
|
|
1847
1847
|
$ dotenvx keypair DOTENV_PRIVATE_KEY
|
|
@@ -1854,7 +1854,7 @@ $ dotenvx keypair DOTENV_PRIVATE_KEY
|
|
|
1854
1854
|
Print a shell formatted response of public/private keys.
|
|
1855
1855
|
|
|
1856
1856
|
```sh
|
|
1857
|
-
$ echo "HELLO=
|
|
1857
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1858
1858
|
$ dotenx encrypt
|
|
1859
1859
|
|
|
1860
1860
|
$ dotenvx keypair --format shell
|
|
@@ -1939,7 +1939,7 @@ $ dotenvx ls -ef '**/.env.prod*'
|
|
|
1939
1939
|
Rotate public/private keys for `.env` file and re-encrypt all encrypted values.
|
|
1940
1940
|
|
|
1941
1941
|
```sh
|
|
1942
|
-
$ echo "HELLO=
|
|
1942
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1943
1943
|
$ dotenvx encrypt
|
|
1944
1944
|
β encrypted (.env)
|
|
1945
1945
|
$ dotenvx rotate
|
|
@@ -1952,7 +1952,7 @@ $ dotenvx rotate
|
|
|
1952
1952
|
Rotate public/private keys for a specified encrypted `.env` file and re-encrypt all encrypted values.
|
|
1953
1953
|
|
|
1954
1954
|
```sh
|
|
1955
|
-
$ echo "HELLO=
|
|
1955
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
1956
1956
|
$ echo "HELLO=Production" > .env.production
|
|
1957
1957
|
|
|
1958
1958
|
$ dotenvx encrypt -f .env.production
|
|
@@ -1968,7 +1968,7 @@ Specify path to `.env.keys`. This is useful with monorepos.
|
|
|
1968
1968
|
|
|
1969
1969
|
```sh
|
|
1970
1970
|
$ mkdir -p apps/app1
|
|
1971
|
-
$ echo "HELLO=
|
|
1971
|
+
$ echo "HELLO=Dotenvx" > apps/app1/.env
|
|
1972
1972
|
|
|
1973
1973
|
$ dotenvx encrypt -fk .env.keys -f apps/app1/.env
|
|
1974
1974
|
β encrypted (apps/app1/.env)
|
|
@@ -1982,7 +1982,7 @@ $ dotenvx rotate -fk .env.keys -f apps/app1/.env
|
|
|
1982
1982
|
Rotate the contents of a specified key inside an encrypted `.env` file.
|
|
1983
1983
|
|
|
1984
1984
|
```sh
|
|
1985
|
-
$ echo "HELLO=
|
|
1985
|
+
$ echo "HELLO=Dotenvx\nHOLA=Mundo" > .env
|
|
1986
1986
|
$ dotenvx encrypt
|
|
1987
1987
|
β encrypted (.env)
|
|
1988
1988
|
$ dotenvx rotate -k HELLO
|
|
@@ -1992,7 +1992,7 @@ $ dotenvx rotate -k HELLO
|
|
|
1992
1992
|
Even specify a glob pattern.
|
|
1993
1993
|
|
|
1994
1994
|
```sh
|
|
1995
|
-
$ echo "HELLO=
|
|
1995
|
+
$ echo "HELLO=Dotenvx\nHOLA=Mundo" > .env
|
|
1996
1996
|
$ dotenvx encrypt
|
|
1997
1997
|
β encrypted (.env)
|
|
1998
1998
|
$ dotenvx rotate -k "HE*"
|
|
@@ -2005,7 +2005,7 @@ $ dotenvx rotate -k "HE*"
|
|
|
2005
2005
|
Rotate the encrypted contents inside an encrypted `.env` file except for an excluded key.
|
|
2006
2006
|
|
|
2007
2007
|
```sh
|
|
2008
|
-
$ echo "HELLO=
|
|
2008
|
+
$ echo "HELLO=Dotenvx\nHOLA=Mundo" > .env
|
|
2009
2009
|
$ dotenvx encrypt
|
|
2010
2010
|
β encrypted (.env)
|
|
2011
2011
|
$ dotenvx rotate -ek HOLA
|
|
@@ -2015,7 +2015,7 @@ $ dotenvx rotate -ek HOLA
|
|
|
2015
2015
|
Even specify a glob pattern.
|
|
2016
2016
|
|
|
2017
2017
|
```sh
|
|
2018
|
-
$ echo "HELLO=
|
|
2018
|
+
$ echo "HELLO=Dotenvx\nHOLA=Mundo" > .env
|
|
2019
2019
|
$ dotenvx encrypt
|
|
2020
2020
|
β encrypted (.env)
|
|
2021
2021
|
$ dotenvx rotate -ek "HO*"
|
|
@@ -2086,7 +2086,7 @@ Usage: @dotenvx/dotenvx run [options]
|
|
|
2086
2086
|
inject env at runtime [dotenvx run -- yourcommand]
|
|
2087
2087
|
|
|
2088
2088
|
Options:
|
|
2089
|
-
-e, --env <strings...> environment variable(s) set as string (example: "HELLO=
|
|
2089
|
+
-e, --env <strings...> environment variable(s) set as string (example: "HELLO=Dotenvx") (default: [])
|
|
2090
2090
|
-f, --env-file <paths...> path(s) to your env file(s) (default: [])
|
|
2091
2091
|
-fv, --env-vault-file <paths...> path(s) to your .env.vault file(s) (default: [])
|
|
2092
2092
|
-o, --overload override existing env variables
|
|
@@ -2102,12 +2102,12 @@ Examples:
|
|
|
2102
2102
|
|
|
2103
2103
|
Try it:
|
|
2104
2104
|
|
|
2105
|
-
$ echo "HELLO=
|
|
2105
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
2106
2106
|
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
|
2107
2107
|
|
|
2108
2108
|
$ dotenvx run -- node index.js
|
|
2109
2109
|
[dotenvx@1.X.X] injecting env (1) from .env
|
|
2110
|
-
Hello
|
|
2110
|
+
Hello Dotenvx
|
|
2111
2111
|
```
|
|
2112
2112
|
|
|
2113
2113
|
</details>
|
|
@@ -2131,7 +2131,7 @@ CLI extensions.
|
|
|
2131
2131
|
In one command, generate a `.env.example` file from your current `.env` file contents.
|
|
2132
2132
|
|
|
2133
2133
|
```sh
|
|
2134
|
-
$ echo "HELLO=
|
|
2134
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
2135
2135
|
|
|
2136
2136
|
$ dotenvx ext genexample
|
|
2137
2137
|
β£ generated (.env.example)
|
|
@@ -2148,7 +2148,7 @@ HELLO=""
|
|
|
2148
2148
|
Pass multiple `.env` files to generate your `.env.example` file from the combination of their contents.
|
|
2149
2149
|
|
|
2150
2150
|
```sh
|
|
2151
|
-
$ echo "HELLO=
|
|
2151
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
2152
2152
|
$ echo "DB_HOST=example.com" > .env.production
|
|
2153
2153
|
|
|
2154
2154
|
$ dotenvx ext genexample -f .env -f .env.production
|
|
@@ -2167,7 +2167,7 @@ DB_HOST=""
|
|
|
2167
2167
|
Generate a `.env.example` file inside the specified directory. Useful for monorepos.
|
|
2168
2168
|
|
|
2169
2169
|
```sh
|
|
2170
|
-
$ echo "HELLO=
|
|
2170
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
2171
2171
|
$ mkdir -p apps/backend
|
|
2172
2172
|
$ echo "HELLO=Backend" > apps/backend/.env
|
|
2173
2173
|
|
|
@@ -2226,7 +2226,7 @@ $ dotenvx ext precommit --install
|
|
|
2226
2226
|
Prevent `.env` files from being committed to code inside a specified path to a directory.
|
|
2227
2227
|
|
|
2228
2228
|
```sh
|
|
2229
|
-
$ echo "HELLO=
|
|
2229
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
2230
2230
|
$ mkdir -p apps/backend
|
|
2231
2231
|
$ echo "HELLO=Backend" > apps/backend/.env
|
|
2232
2232
|
|
|
@@ -2293,7 +2293,7 @@ Use directly in node.js code.
|
|
|
2293
2293
|
|
|
2294
2294
|
```ini
|
|
2295
2295
|
# .env
|
|
2296
|
-
HELLO="
|
|
2296
|
+
HELLO="Dotenvx"
|
|
2297
2297
|
```
|
|
2298
2298
|
|
|
2299
2299
|
```js
|
|
@@ -2306,7 +2306,7 @@ console.log(`Hello ${process.env.HELLO}`)
|
|
|
2306
2306
|
```sh
|
|
2307
2307
|
$ node index.js
|
|
2308
2308
|
[dotenvx@1.X.X] injecting env (1) from .env
|
|
2309
|
-
Hello
|
|
2309
|
+
Hello Dotenvx
|
|
2310
2310
|
```
|
|
2311
2311
|
|
|
2312
2312
|
It defaults to looking for a `.env` file.
|
|
@@ -2323,7 +2323,7 @@ HELLO="Me"
|
|
|
2323
2323
|
|
|
2324
2324
|
```ini
|
|
2325
2325
|
# .env
|
|
2326
|
-
HELLO="
|
|
2326
|
+
HELLO="Dotenvx"
|
|
2327
2327
|
```
|
|
2328
2328
|
|
|
2329
2329
|
```js
|
|
@@ -2355,7 +2355,7 @@ HELLO="Me"
|
|
|
2355
2355
|
|
|
2356
2356
|
```ini
|
|
2357
2357
|
# .env
|
|
2358
|
-
HELLO="
|
|
2358
|
+
HELLO="Dotenvx"
|
|
2359
2359
|
```
|
|
2360
2360
|
|
|
2361
2361
|
```js
|
|
@@ -2372,7 +2372,7 @@ console.log(`Hello ${process.env.HELLO}`)
|
|
|
2372
2372
|
```sh
|
|
2373
2373
|
$ node index.js
|
|
2374
2374
|
[dotenvx@1.X.X] injecting env (1) from .env.local, .env
|
|
2375
|
-
Hello
|
|
2375
|
+
Hello Dotenvx
|
|
2376
2376
|
```
|
|
2377
2377
|
|
|
2378
2378
|
</details>
|
|
@@ -2382,7 +2382,7 @@ Suppress all output (except errors).
|
|
|
2382
2382
|
|
|
2383
2383
|
```ini
|
|
2384
2384
|
# .env
|
|
2385
|
-
HELLO="
|
|
2385
|
+
HELLO="Dotenvx"
|
|
2386
2386
|
```
|
|
2387
2387
|
|
|
2388
2388
|
```js
|
|
@@ -2399,7 +2399,7 @@ console.log(`Hello ${process.env.HELLO}`)
|
|
|
2399
2399
|
```sh
|
|
2400
2400
|
$ node index.js
|
|
2401
2401
|
Error: [MISSING_ENV_FILE] missing .env.missing file (/path/to/.env.missing)
|
|
2402
|
-
Hello
|
|
2402
|
+
Hello Dotenvx
|
|
2403
2403
|
```
|
|
2404
2404
|
|
|
2405
2405
|
</details>
|
|
@@ -2409,7 +2409,7 @@ Exit with code `1` if any errors are encountered - like a missing .env file or d
|
|
|
2409
2409
|
|
|
2410
2410
|
```ini
|
|
2411
2411
|
# .env
|
|
2412
|
-
HELLO="
|
|
2412
|
+
HELLO="Dotenvx"
|
|
2413
2413
|
```
|
|
2414
2414
|
|
|
2415
2415
|
```js
|
|
@@ -2435,7 +2435,7 @@ Use `ignore` to suppress specific errors like `MISSING_ENV_FILE`.
|
|
|
2435
2435
|
|
|
2436
2436
|
```ini
|
|
2437
2437
|
# .env
|
|
2438
|
-
HELLO="
|
|
2438
|
+
HELLO="Dotenvx"
|
|
2439
2439
|
```
|
|
2440
2440
|
|
|
2441
2441
|
```js
|
|
@@ -2452,7 +2452,7 @@ console.log(`Hello ${process.env.HELLO}`)
|
|
|
2452
2452
|
```sh
|
|
2453
2453
|
$ node index.js
|
|
2454
2454
|
[dotenvx@1.X.X] injecting env (1) from .env
|
|
2455
|
-
Hello
|
|
2455
|
+
Hello Dotenvx
|
|
2456
2456
|
```
|
|
2457
2457
|
|
|
2458
2458
|
</details>
|
|
@@ -2462,7 +2462,7 @@ Use `envKeysFile` to customize the path to your `.env.keys` file. This is useful
|
|
|
2462
2462
|
|
|
2463
2463
|
```ini
|
|
2464
2464
|
# .env
|
|
2465
|
-
HELLO="
|
|
2465
|
+
HELLO="Dotenvx"
|
|
2466
2466
|
```
|
|
2467
2467
|
|
|
2468
2468
|
```js
|
|
@@ -2520,14 +2520,14 @@ Parse a `.env` string directly in node.js code.
|
|
|
2520
2520
|
```js
|
|
2521
2521
|
// index.js
|
|
2522
2522
|
const dotenvx = require('@dotenvx/dotenvx')
|
|
2523
|
-
const src = 'HELLO=
|
|
2523
|
+
const src = 'HELLO=Dotenvx'
|
|
2524
2524
|
const parsed = dotenvx.parse(src)
|
|
2525
2525
|
console.log(`Hello ${parsed.HELLO}`)
|
|
2526
2526
|
```
|
|
2527
2527
|
|
|
2528
2528
|
```sh
|
|
2529
2529
|
$ node index.js
|
|
2530
|
-
Hello
|
|
2530
|
+
Hello Dotenvx
|
|
2531
2531
|
```
|
|
2532
2532
|
|
|
2533
2533
|
</details>
|
|
@@ -2563,7 +2563,7 @@ console.log(`Hello ${parsed.HELLO}`)
|
|
|
2563
2563
|
|
|
2564
2564
|
```sh
|
|
2565
2565
|
$ node index.js
|
|
2566
|
-
Hello
|
|
2566
|
+
Hello Dotenvx
|
|
2567
2567
|
```
|
|
2568
2568
|
</details>
|
|
2569
2569
|
<details><summary>`set(KEY, value)`</summary><br>
|
|
@@ -2573,7 +2573,7 @@ Programmatically set an environment variable.
|
|
|
2573
2573
|
```js
|
|
2574
2574
|
// index.js
|
|
2575
2575
|
const dotenvx = require('@dotenvx/dotenvx')
|
|
2576
|
-
dotenvx.set('HELLO', '
|
|
2576
|
+
dotenvx.set('HELLO', 'Dotenvx', { path: '.env' })
|
|
2577
2577
|
```
|
|
2578
2578
|
|
|
2579
2579
|
</details>
|
|
@@ -2584,7 +2584,7 @@ Programmatically set a plaintext environment variable.
|
|
|
2584
2584
|
```js
|
|
2585
2585
|
// index.js
|
|
2586
2586
|
const dotenvx = require('@dotenvx/dotenvx')
|
|
2587
|
-
dotenvx.set('HELLO', '
|
|
2587
|
+
dotenvx.set('HELLO', 'Dotenvx', { plain: true })
|
|
2588
2588
|
```
|
|
2589
2589
|
|
|
2590
2590
|
</details>
|
|
@@ -2773,23 +2773,6 @@ This fix is easy. Replace `--env-file` with `-f`.
|
|
|
2773
2773
|
|
|
2774
2774
|
[more context](https://github.com/dotenvx/dotenvx/issues/131)
|
|
2775
2775
|
|
|
2776
|
-
#### What happened to the `.env.vault` file?
|
|
2777
|
-
|
|
2778
|
-
I've decided we should sunset it as a technological solution to this.
|
|
2779
|
-
|
|
2780
|
-
The `.env.vault` file got us far, but it had limitations such as:
|
|
2781
|
-
|
|
2782
|
-
* *Pull Requests* - it was difficult to tell which key had been changed
|
|
2783
|
-
* *Security* - there was no mechanism to give a teammate the ability to encrypt without also giving them the ability to decrypt. Sometimes you just want to let a contractor encrypt a new value, but you don't want them to know the rest of the secrets.
|
|
2784
|
-
* *Conceptual* - it takes more mental energy to understand the `.env.vault` format. Encrypted values inside a `.env` file is easier to quickly grasp.
|
|
2785
|
-
* *Combining Multiple Files* - there was simply no mechanism to do this well with the `.env.vault` file format.
|
|
2786
|
-
|
|
2787
|
-
That said, the `.env.vault` tooling will still stick around for at least 1 year under `dotenvx vault` parent command. I'm still using it in projects as are many thousands of other people.
|
|
2788
|
-
|
|
2789
|
-
#### How do I migrate my `.env.vault` file(s) to encrypted `.env` files?
|
|
2790
|
-
|
|
2791
|
-
Run `$ dotenvx ext vault migrate` and follow the instructions.
|
|
2792
|
-
|
|
2793
2776
|
|
|
2794
2777
|
|
|
2795
2778
|
## Contributing
|
package/package.json
CHANGED