@dotenvx/dotenvx 0.6.2 β 0.6.3
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/README.md +122 -63
- package/package.json +1 -1
- package/src/cli/dotenvx.js +3 -3
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
* [run anywhere](#run-anywhere) (cross-platform)
|
|
6
6
|
* [multi-environment](#multiple-environments)
|
|
7
|
-
* [encrypted envs](#
|
|
7
|
+
* [encrypted envs](#encryption)
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
```sh
|
|
15
15
|
brew install dotenvx/brew/dotenvx
|
|
16
16
|
```
|
|
17
|
-
> * [other ways to install](
|
|
17
|
+
> * [other ways to install](https://dotenvx.com/docs/install)
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
@@ -36,7 +36,7 @@ More examples
|
|
|
36
36
|
* <details><summary>Python π</summary><br>
|
|
37
37
|
|
|
38
38
|
```sh
|
|
39
|
-
$ echo 'import os;print("Hello " + os.getenv("HELLO", ""))' > index.py
|
|
39
|
+
$ echo "HELLO=World" > .env && echo 'import os;print("Hello " + os.getenv("HELLO", ""))' > index.py
|
|
40
40
|
|
|
41
41
|
$ dotenvx run -- python3 index.py
|
|
42
42
|
Hello World
|
|
@@ -46,7 +46,7 @@ More examples
|
|
|
46
46
|
* <details><summary>PHP π</summary><br>
|
|
47
47
|
|
|
48
48
|
```sh
|
|
49
|
-
$ echo '<?php echo "Hello {$_SERVER["HELLO"]}\n";' > index.php
|
|
49
|
+
$ echo "HELLO=World" > .env && echo '<?php echo "Hello {$_SERVER["HELLO"]}\n";' > index.php
|
|
50
50
|
|
|
51
51
|
$ dotenvx run -- php index.php
|
|
52
52
|
Hello World
|
|
@@ -56,7 +56,7 @@ More examples
|
|
|
56
56
|
* <details><summary>Ruby π</summary><br>
|
|
57
57
|
|
|
58
58
|
```sh
|
|
59
|
-
$ echo 'puts "Hello #{ENV["HELLO"]}"' > index.rb
|
|
59
|
+
$ echo "HELLO=World" > .env && echo 'puts "Hello #{ENV["HELLO"]}"' > index.rb
|
|
60
60
|
|
|
61
61
|
$ dotenvx run -- ruby index.rb
|
|
62
62
|
Hello World
|
|
@@ -66,7 +66,7 @@ More examples
|
|
|
66
66
|
* <details><summary>Rust π¦</summary><br>
|
|
67
67
|
|
|
68
68
|
```sh
|
|
69
|
-
$ echo 'fn main() {let hello = std::env::var("HELLO").unwrap_or("".to_string());println!("Hello {hello}");}' > src/main.rs
|
|
69
|
+
$ echo "HELLO=World" > .env && echo 'fn main() {let hello = std::env::var("HELLO").unwrap_or("".to_string());println!("Hello {hello}");}' > src/main.rs
|
|
70
70
|
|
|
71
71
|
$ dotenvx run -- cargo run
|
|
72
72
|
Hello World
|
|
@@ -76,7 +76,7 @@ More examples
|
|
|
76
76
|
* <details><summary>Java βοΈ</summary><br>
|
|
77
77
|
|
|
78
78
|
```sh
|
|
79
|
-
$ echo 'public class Index { public static void main(String[] args) { System.out.println("Hello " + System.getenv("HELLO")); } }' > index.java
|
|
79
|
+
$ echo "HELLO=World" > .env && echo 'public class Index { public static void main(String[] args) { System.out.println("Hello " + System.getenv("HELLO")); } }' > index.java
|
|
80
80
|
|
|
81
81
|
$ dotenvx run -- java index.java
|
|
82
82
|
Hello World
|
|
@@ -88,7 +88,7 @@ More examples
|
|
|
88
88
|
```sh
|
|
89
89
|
$ dotnet new console -n HelloWorld -o HelloWorld
|
|
90
90
|
$ cd HelloWorld
|
|
91
|
-
$ echo 'Console.WriteLine($"Hello {Environment.GetEnvironmentVariable("HELLO")}");' > Program.cs && echo "HELLO=World" > .env
|
|
91
|
+
$ echo "HELLO=World" > .env && echo 'Console.WriteLine($"Hello {Environment.GetEnvironmentVariable("HELLO")}");' > Program.cs && echo "HELLO=World" > .env
|
|
92
92
|
|
|
93
93
|
$ dotenvx run -- dotnet run
|
|
94
94
|
Hello World
|
|
@@ -192,7 +192,7 @@ More examples
|
|
|
192
192
|
|
|
193
193
|
> Create a `.env.production` file and use `--env-file` to load it. It's straightforward, yet flexible.
|
|
194
194
|
```sh
|
|
195
|
-
$ echo "HELLO=production" > .env.production
|
|
195
|
+
$ echo "HELLO=production" > .env.production && echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
|
196
196
|
|
|
197
197
|
$ dotenvx run --env-file=.env.production -- node index.js
|
|
198
198
|
Hello production
|
|
@@ -260,11 +260,11 @@ More examples
|
|
|
260
260
|
|
|
261
261
|
|
|
262
262
|
|
|
263
|
-
##
|
|
263
|
+
## Encryption
|
|
264
264
|
|
|
265
265
|
> Encrypt your secrets to a `.env.vault` file.
|
|
266
266
|
```
|
|
267
|
-
$ echo "HELLO=World" > .env
|
|
267
|
+
$ echo "HELLO=World" > .env && echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
|
268
268
|
|
|
269
269
|
$ echo "HELLO=production" > .env.production
|
|
270
270
|
|
|
@@ -286,16 +286,124 @@ $ dotenvx encrypt
|
|
|
286
286
|
[dotenvx][INFO] * .env.keys file holds your decryption DOTENV_KEYs
|
|
287
287
|
[dotenvx][INFO] * DO NOT commit .env.keys to code
|
|
288
288
|
[dotenvx][INFO] * share .env.keys file over secure channels only
|
|
289
|
+
> :-]
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
> Then load env from encrypted `.env.vault` file
|
|
289
295
|
|
|
290
|
-
|
|
296
|
+
```sh
|
|
297
|
+
$ DOTENV_KEY='dotenv://:key_abc123@dotenvx.com/vault/.env.vault?environment=production' dotenvx run -- node index.js
|
|
291
298
|
[dotenvx][INFO] injecting 1 environment variable from encrypted .env.vault
|
|
292
|
-
Hello
|
|
299
|
+
Hello production
|
|
293
300
|
|
|
294
301
|
> :-]
|
|
295
302
|
```
|
|
296
303
|
|
|
304
|
+
More examples
|
|
305
|
+
|
|
306
|
+
* <details><summary>AWS Lambda</summary><br>
|
|
307
|
+
|
|
308
|
+
```sh
|
|
309
|
+
coming soon
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
</details>
|
|
313
|
+
|
|
314
|
+
* <details><summary>Digital Ocean</summary><br>
|
|
315
|
+
|
|
316
|
+
```sh
|
|
317
|
+
coming soon
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
</details>
|
|
321
|
+
|
|
322
|
+
* <details><summary>Docker</summary><br>
|
|
323
|
+
|
|
324
|
+
```sh
|
|
325
|
+
coming soon
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
</details>
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
* <details><summary>Fly.io</summary><br>
|
|
332
|
+
|
|
333
|
+
```sh
|
|
334
|
+
coming soon
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
</details>
|
|
338
|
+
|
|
339
|
+
* <details><summary>Heroku</summary><br>
|
|
340
|
+
|
|
341
|
+
```sh
|
|
342
|
+
coming soon
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
</details>
|
|
346
|
+
|
|
347
|
+
* <details><summary>Laravel Forge</summary><br>
|
|
348
|
+
|
|
349
|
+
```sh
|
|
350
|
+
coming soon
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
</details>
|
|
354
|
+
|
|
355
|
+
* <details><summary>Netlify</summary><br>
|
|
356
|
+
|
|
357
|
+
```sh
|
|
358
|
+
coming soon
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
</details>
|
|
362
|
+
|
|
363
|
+
* <details><summary>Railway</summary><br>
|
|
364
|
+
|
|
365
|
+
```sh
|
|
366
|
+
coming soon
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
</details>
|
|
370
|
+
|
|
371
|
+
* <details><summary>Render</summary><br>
|
|
372
|
+
|
|
373
|
+
```sh
|
|
374
|
+
coming soon
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
</details>
|
|
378
|
+
|
|
379
|
+
* <details><summary>Vercel</summary><br>
|
|
380
|
+
|
|
381
|
+
```sh
|
|
382
|
+
coming soon
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
</details>
|
|
386
|
+
|
|
387
|
+
* <details><summary>CircleCI</summary><br>
|
|
388
|
+
|
|
389
|
+
```sh
|
|
390
|
+
coming soon
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
</details>
|
|
394
|
+
|
|
395
|
+
* <details><summary>GitHub Actions</summary><br>
|
|
396
|
+
|
|
397
|
+
```sh
|
|
398
|
+
coming soon
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
</details>
|
|
402
|
+
|
|
297
403
|
|
|
298
404
|
|
|
405
|
+
---
|
|
406
|
+
|
|
299
407
|
## Usage
|
|
300
408
|
|
|
301
409
|
### Guide
|
|
@@ -370,58 +478,9 @@ Hello World
|
|
|
370
478
|
|
|
371
479
|
|
|
372
480
|
|
|
373
|
-
|
|
374
|
-
## Install
|
|
375
|
-
|
|
376
|
-
Installing with [`brew`](https://brew.sh) is most straight forward:
|
|
377
|
-
|
|
378
|
-
```sh
|
|
379
|
-
brew install dotenvx/brew/dotenvx
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
### Other Ways to Install
|
|
383
|
-
|
|
384
|
-
#### 1. global npm
|
|
385
|
-
|
|
386
|
-
After `brew`, installing globally using [`npm`](https://www.npmjs.com/package/@dotenvx/dotenvx) is easiest:
|
|
387
|
-
|
|
388
|
-
```sh
|
|
389
|
-
npm install @dotenvx/dotenvx --global
|
|
390
|
-
```
|
|
391
|
-
|
|
392
|
-
#### 2. local npm
|
|
393
|
-
|
|
394
|
-
Or install in your `package.json`:
|
|
395
|
-
|
|
396
|
-
```sh
|
|
397
|
-
npm i @dotenvx/dotenvx --save
|
|
398
|
-
```
|
|
399
|
-
```json
|
|
400
|
-
{
|
|
401
|
-
"scripts": {
|
|
402
|
-
"start": "./node_modules/.bin/dotenvx run -- node index.js"
|
|
403
|
-
},
|
|
404
|
-
"dependencies": {
|
|
405
|
-
"@dotenvx/dotenvx": "^0.6.0"
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
#### 3. standalone binary
|
|
411
|
-
|
|
412
|
-
Or download it directly as a standalone binary:
|
|
413
|
-
|
|
414
|
-
```sh
|
|
415
|
-
# download it to `/user/local/bin/dotenvx`
|
|
416
|
-
curl -fsS https://dotenvx.sh/ | sh
|
|
417
|
-
|
|
418
|
-
# check it works
|
|
419
|
-
dotenvx help
|
|
420
|
-
```
|
|
421
|
-
|
|
422
481
|
## Contributing
|
|
423
482
|
|
|
424
|
-
|
|
483
|
+
You can fork this repo and create [pull requests](https://github.com/dotenvx/dotenvx/pulls) or if you have questions or feedback:
|
|
425
484
|
|
|
426
485
|
* [github.com/dotenvx/dotenvx](https://github.com/dotenvx/dotenvx/issues) - bugs and discussions
|
|
427
486
|
* [@dotenvx π](https://x.com/dotenvx) (DMs are open)
|
package/package.json
CHANGED
package/src/cli/dotenvx.js
CHANGED
|
@@ -210,9 +210,9 @@ program.command('encrypt')
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
let keysData = `#/!!!!!!!!!!!!!!!!!!!.env.keys!!!!!!!!!!!!!!!!!!!!!!/
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
213
|
+
#/ DOTENV_KEYs. DO NOT commit to source control /
|
|
214
|
+
#/ [how it works](https://dotenv.org/env-keys) /
|
|
215
|
+
#/--------------------------------------------------/\n`
|
|
216
216
|
|
|
217
217
|
for (const key in dotenvKeys) {
|
|
218
218
|
const value = dotenvKeys[key]
|