@dotenvx/dotenvx 2.1.5 → 2.2.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 +13 -1
- package/README.md +264 -99
- package/package.json +1 -1
- package/src/cli/actions/decrypt.js +3 -0
- package/src/cli/actions/encrypt.js +3 -2
- package/src/cli/actions/get.js +2 -0
- package/src/cli/actions/keychain/down.js +29 -0
- package/src/cli/actions/keychain/pull.js +29 -0
- package/src/cli/actions/keychain/push.js +29 -0
- package/src/cli/actions/keychain/up.js +29 -0
- package/src/cli/actions/keypair.js +1 -0
- package/src/cli/actions/run.js +2 -0
- package/src/cli/actions/set.js +2 -1
- package/src/cli/commands/keychain.js +43 -0
- package/src/cli/dotenvx.js +26 -7
- package/src/lib/main.d.ts +24 -0
- package/src/lib/main.js +11 -1
- package/src/lib/providers/index.js +76 -15
- package/src/lib/providers/keychain/index.js +20 -0
- package/src/lib/resolvers/envs.js +2 -2
- package/src/lib/resolvers/get.js +1 -0
- package/src/lib/services/genexample.js +1 -1
- package/src/lib/services/keychainDown.js +57 -0
- package/src/lib/services/keychainPull.js +46 -0
- package/src/lib/services/keychainPush.js +63 -0
- package/src/lib/services/keychainUp.js +81 -0
- package/src/lib/transforms/decrypt.js +1 -1
- package/src/lib/transforms/set.js +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,19 @@
|
|
|
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.1
|
|
5
|
+
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v2.2.1...main)
|
|
6
|
+
|
|
7
|
+
## [2.2.1](https://github.com/dotenvx/dotenvx/compare/v2.2.0...v2.2.1) (2026-07-08)
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
* Move `genexample` to top level commands ([#873](https://github.com/dotenvx/dotenvx/pull/873))
|
|
12
|
+
|
|
13
|
+
## [2.2.0](https://github.com/dotenvx/dotenvx/compare/v2.1.5...v2.2.0) (2026-07-07)
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
* Use `dotenvx keychain up|down` to move your private keys to your macOS Keychain ([#872](https://github.com/dotenvx/dotenvx/pull/872))
|
|
6
18
|
|
|
7
19
|
## [2.1.5](https://github.com/dotenvx/dotenvx/compare/v2.1.4...v2.1.5) (2026-07-06)
|
|
8
20
|
|
package/README.md
CHANGED
|
@@ -1384,6 +1384,15 @@ Set Armor ⛨ token for retrieving armored private keys.
|
|
|
1384
1384
|
$ dotenvx run --token "$DOTENVX_ARMOR_TOKEN" -- yourcommand
|
|
1385
1385
|
```
|
|
1386
1386
|
|
|
1387
|
+
</details>
|
|
1388
|
+
<details><summary>`run --no-keychain`</summary><br>
|
|
1389
|
+
|
|
1390
|
+
Turn off macOS Keychain lookups.
|
|
1391
|
+
|
|
1392
|
+
```sh
|
|
1393
|
+
$ dotenvx run --no-keychain -- yourcommand
|
|
1394
|
+
```
|
|
1395
|
+
|
|
1387
1396
|
</details>
|
|
1388
1397
|
<details><summary>`run --no-armor`</summary><br>
|
|
1389
1398
|
|
|
@@ -1393,8 +1402,6 @@ Turn off [Dotenvx Armor ⛨](https://dotenvx.com/armor) features.
|
|
|
1393
1402
|
$ dotenvx run --no-armor -- yourcommand
|
|
1394
1403
|
```
|
|
1395
1404
|
|
|
1396
|
-
`--no-vlt` and `--no-ops` are deprecated aliases.
|
|
1397
|
-
|
|
1398
1405
|
</details>
|
|
1399
1406
|
<details><summary>`get KEY`</summary><br>
|
|
1400
1407
|
|
|
@@ -1407,6 +1414,15 @@ $ dotenvx get HELLO
|
|
|
1407
1414
|
World
|
|
1408
1415
|
```
|
|
1409
1416
|
|
|
1417
|
+
</details>
|
|
1418
|
+
<details><summary>`get KEY --no-keychain`</summary><br>
|
|
1419
|
+
|
|
1420
|
+
Turn off macOS Keychain lookups for get.
|
|
1421
|
+
|
|
1422
|
+
```sh
|
|
1423
|
+
$ dotenvx get HELLO --no-keychain
|
|
1424
|
+
```
|
|
1425
|
+
|
|
1410
1426
|
</details>
|
|
1411
1427
|
<details><summary>`get KEY -f`</summary><br>
|
|
1412
1428
|
|
|
@@ -1722,6 +1738,15 @@ set HELLO_PLAIN (.env)
|
|
|
1722
1738
|
|
|
1723
1739
|
Keys ending in `_PLAIN` are not encrypted by `dotenvx set` or `dotenvx encrypt`.
|
|
1724
1740
|
|
|
1741
|
+
</details>
|
|
1742
|
+
<details><summary>`set KEY value --no-keychain`</summary><br>
|
|
1743
|
+
|
|
1744
|
+
Turn off macOS Keychain lookups for set.
|
|
1745
|
+
|
|
1746
|
+
```sh
|
|
1747
|
+
$ dotenvx set HELLO Dotenvx --no-keychain
|
|
1748
|
+
```
|
|
1749
|
+
|
|
1725
1750
|
</details>
|
|
1726
1751
|
<details><summary>`encrypt`</summary><br>
|
|
1727
1752
|
|
|
@@ -1753,6 +1778,16 @@ $ dotenvx encrypt -f .env.production
|
|
|
1753
1778
|
⮕ next run [DOTENV_PRIVATE_KEY='bff...bc4' dotenvx run -- yourcommand] to test decryption locally
|
|
1754
1779
|
```
|
|
1755
1780
|
|
|
1781
|
+
</details>
|
|
1782
|
+
<details><summary>`encrypt --no-keychain`</summary><br>
|
|
1783
|
+
|
|
1784
|
+
Turn off macOS Keychain lookups for encrypt.
|
|
1785
|
+
|
|
1786
|
+
```sh
|
|
1787
|
+
$ dotenvx encrypt --no-keychain
|
|
1788
|
+
◈ encrypted (.env)
|
|
1789
|
+
```
|
|
1790
|
+
|
|
1756
1791
|
</details>
|
|
1757
1792
|
<details><summary>`encrypt --no-armor`</summary><br>
|
|
1758
1793
|
|
|
@@ -1763,8 +1798,6 @@ $ dotenvx encrypt --no-armor
|
|
|
1763
1798
|
◈ encrypted (.env)
|
|
1764
1799
|
```
|
|
1765
1800
|
|
|
1766
|
-
`--no-vlt` and `--no-ops` are deprecated aliases.
|
|
1767
|
-
|
|
1768
1801
|
</details>
|
|
1769
1802
|
<details><summary>`encrypt -fk`</summary><br>
|
|
1770
1803
|
|
|
@@ -1884,6 +1917,16 @@ $ dotenvx decrypt
|
|
|
1884
1917
|
◇ decrypted (.env)
|
|
1885
1918
|
```
|
|
1886
1919
|
|
|
1920
|
+
</details>
|
|
1921
|
+
<details><summary>`decrypt --no-keychain`</summary><br>
|
|
1922
|
+
|
|
1923
|
+
Turn off macOS Keychain lookups for decrypt.
|
|
1924
|
+
|
|
1925
|
+
```sh
|
|
1926
|
+
$ dotenvx decrypt --no-keychain
|
|
1927
|
+
◇ decrypted (.env)
|
|
1928
|
+
```
|
|
1929
|
+
|
|
1887
1930
|
</details>
|
|
1888
1931
|
<details><summary>`decrypt -f`</summary><br>
|
|
1889
1932
|
|
|
@@ -1995,6 +2038,16 @@ $ dotenvx keypair
|
|
|
1995
2038
|
{"DOTENV_PUBLIC_KEY":"<publicKey>","DOTENV_PRIVATE_KEY":"<privateKey>"}
|
|
1996
2039
|
```
|
|
1997
2040
|
|
|
2041
|
+
</details>
|
|
2042
|
+
<details><summary>`keypair --no-keychain`</summary><br>
|
|
2043
|
+
|
|
2044
|
+
Turn off macOS Keychain lookups for keypair.
|
|
2045
|
+
|
|
2046
|
+
```sh
|
|
2047
|
+
$ dotenvx keypair --no-keychain
|
|
2048
|
+
{"DOTENV_PUBLIC_KEY":"<publicKey>","DOTENV_PRIVATE_KEY":"<privateKey>"}
|
|
2049
|
+
```
|
|
2050
|
+
|
|
1998
2051
|
</details>
|
|
1999
2052
|
<details><summary>`keypair -f`</summary><br>
|
|
2000
2053
|
|
|
@@ -2121,101 +2174,14 @@ $ dotenvx ls -ef '**/.env.prod*'
|
|
|
2121
2174
|
```
|
|
2122
2175
|
|
|
2123
2176
|
</details>
|
|
2124
|
-
<details><summary>`
|
|
2125
|
-
|
|
2126
|
-
Output help for `dotenvx`.
|
|
2127
|
-
|
|
2128
|
-
```sh
|
|
2129
|
-
$ dotenvx help
|
|
2130
|
-
Usage: dotenvx run -- yourcommand
|
|
2131
|
-
|
|
2132
|
-
a secure dotenv–from the creator of `dotenv`
|
|
2133
|
-
|
|
2134
|
-
Options:
|
|
2135
|
-
-l, --log-level <level> set log level (default: "info")
|
|
2136
|
-
-q, --quiet sets log level to error
|
|
2137
|
-
-v, --verbose sets log level to verbose
|
|
2138
|
-
-d, --debug sets log level to debug
|
|
2139
|
-
-V, --version output the version number
|
|
2140
|
-
-h, --help display help for command
|
|
2141
|
-
|
|
2142
|
-
Commands:
|
|
2143
|
-
run inject env at runtime [dotenvx run -- yourcommand]
|
|
2144
|
-
get [KEY] return a single environment variable
|
|
2145
|
-
set <KEY> <value> set a single environment variable
|
|
2146
|
-
encrypt encrypt .env file(s)
|
|
2147
|
-
decrypt decrypt .env file(s)
|
|
2148
|
-
keypair [KEY] print public/private keys for .env file(s)
|
|
2149
|
-
ls [directory] print all .env files in a tree structure
|
|
2150
|
-
gitignore append to .gitignore
|
|
2151
|
-
precommit [directory]
|
|
2152
|
-
prevent committing .env files to code
|
|
2153
|
-
prebuild [directory]
|
|
2154
|
-
prevent including .env files in docker
|
|
2155
|
-
|
|
2156
|
-
Professional Security:
|
|
2157
|
-
login log in to move keys off-device, share with your team, and audit access
|
|
2158
|
-
logout log out of connected security features
|
|
2159
|
-
armor ⛨ move private keys off-device [www.dotenvx.com/armor]
|
|
2160
|
-
```
|
|
2161
|
-
|
|
2162
|
-
You can get more detailed help per command with `dotenvx help COMMAND`.
|
|
2163
|
-
|
|
2164
|
-
```sh
|
|
2165
|
-
$ dotenvx help run
|
|
2166
|
-
Usage: @dotenvx/dotenvx run [options]
|
|
2167
|
-
|
|
2168
|
-
inject env at runtime [dotenvx run -- yourcommand]
|
|
2169
|
-
|
|
2170
|
-
Options:
|
|
2171
|
-
-e, --env <strings...> environment variable(s) set as string (example: "HELLO=Dotenvx") (default: [])
|
|
2172
|
-
-f, --env-file <paths...> path(s) to your env file(s) (default: [])
|
|
2173
|
-
-fv, --env-vault-file <paths...> path(s) to your .env.vault file(s) (default: [])
|
|
2174
|
-
-o, --overload override existing env variables
|
|
2175
|
-
--convention <name> load a .env convention (available conventions: ['nextjs'])
|
|
2176
|
-
-h, --help display help for command
|
|
2177
|
-
|
|
2178
|
-
Examples:
|
|
2179
|
-
|
|
2180
|
-
$ dotenvx run -- npm run dev
|
|
2181
|
-
$ dotenvx run -- flask --app index run
|
|
2182
|
-
$ dotenvx run -- php artisan serve
|
|
2183
|
-
$ dotenvx run -- bin/rails s
|
|
2184
|
-
|
|
2185
|
-
Try it:
|
|
2186
|
-
|
|
2187
|
-
$ echo "HELLO=Dotenvx" > .env
|
|
2188
|
-
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
|
2189
|
-
|
|
2190
|
-
$ dotenvx run -- node index.js
|
|
2191
|
-
[dotenvx@1.X.X] injecting env (1) from .env
|
|
2192
|
-
Hello Dotenvx
|
|
2193
|
-
```
|
|
2194
|
-
|
|
2195
|
-
</details>
|
|
2196
|
-
<details><summary>`--version`</summary><br>
|
|
2197
|
-
|
|
2198
|
-
Check current version of `dotenvx`.
|
|
2199
|
-
|
|
2200
|
-
```sh
|
|
2201
|
-
$ dotenvx --version
|
|
2202
|
-
X.X.X
|
|
2203
|
-
```
|
|
2204
|
-
|
|
2205
|
-
</details>
|
|
2206
|
-
|
|
2207
|
-
### Utilities
|
|
2208
|
-
|
|
2209
|
-
Additional workflow helpers.
|
|
2210
|
-
|
|
2211
|
-
<details><summary>`ext genexample`</summary><br>
|
|
2177
|
+
<details><summary>`genexample`</summary><br>
|
|
2212
2178
|
|
|
2213
2179
|
In one command, generate a `.env.example` file from your current `.env` file contents.
|
|
2214
2180
|
|
|
2215
2181
|
```sh
|
|
2216
2182
|
$ echo "HELLO=Dotenvx" > .env
|
|
2217
2183
|
|
|
2218
|
-
$ dotenvx
|
|
2184
|
+
$ dotenvx genexample
|
|
2219
2185
|
▣ generated (.env.example)
|
|
2220
2186
|
```
|
|
2221
2187
|
|
|
@@ -2225,7 +2191,7 @@ HELLO=""
|
|
|
2225
2191
|
```
|
|
2226
2192
|
|
|
2227
2193
|
</details>
|
|
2228
|
-
<details><summary>`
|
|
2194
|
+
<details><summary>`genexample -f`</summary><br>
|
|
2229
2195
|
|
|
2230
2196
|
Pass multiple `.env` files to generate your `.env.example` file from the combination of their contents.
|
|
2231
2197
|
|
|
@@ -2233,7 +2199,7 @@ Pass multiple `.env` files to generate your `.env.example` file from the combina
|
|
|
2233
2199
|
$ echo "HELLO=Dotenvx" > .env
|
|
2234
2200
|
$ echo "DB_HOST=example.com" > .env.production
|
|
2235
2201
|
|
|
2236
|
-
$ dotenvx
|
|
2202
|
+
$ dotenvx genexample -f .env -f .env.production
|
|
2237
2203
|
▣ generated (.env.example)
|
|
2238
2204
|
```
|
|
2239
2205
|
|
|
@@ -2244,7 +2210,7 @@ DB_HOST=""
|
|
|
2244
2210
|
```
|
|
2245
2211
|
|
|
2246
2212
|
</details>
|
|
2247
|
-
<details><summary>`
|
|
2213
|
+
<details><summary>`genexample directory`</summary><br>
|
|
2248
2214
|
|
|
2249
2215
|
Generate a `.env.example` file inside the specified directory. Useful for monorepos.
|
|
2250
2216
|
|
|
@@ -2253,7 +2219,7 @@ $ echo "HELLO=Dotenvx" > .env
|
|
|
2253
2219
|
$ mkdir -p apps/backend
|
|
2254
2220
|
$ echo "HELLO=Backend" > apps/backend/.env
|
|
2255
2221
|
|
|
2256
|
-
$ dotenvx
|
|
2222
|
+
$ dotenvx genexample apps/backend
|
|
2257
2223
|
▣ generated (.env.example)
|
|
2258
2224
|
```
|
|
2259
2225
|
|
|
@@ -2357,6 +2323,207 @@ CMD ["/usr/local/bin/dotenvx", "run", "--", "node", "apps/backend/index.js"]
|
|
|
2357
2323
|
```
|
|
2358
2324
|
|
|
2359
2325
|
</details>
|
|
2326
|
+
<details><summary>`keychain`</summary><br>
|
|
2327
|
+
|
|
2328
|
+
Store private keys in macOS Keychain to keep them out of `.env.keys`.
|
|
2329
|
+
|
|
2330
|
+
Currently supported on macOS.
|
|
2331
|
+
|
|
2332
|
+
</details>
|
|
2333
|
+
<details><summary>`keychain up`</summary><br>
|
|
2334
|
+
|
|
2335
|
+
Move a private key from `.env.keys` into macOS Keychain.
|
|
2336
|
+
|
|
2337
|
+
```sh
|
|
2338
|
+
$ dotenvx keychain up
|
|
2339
|
+
```
|
|
2340
|
+
|
|
2341
|
+
Specify files with `-f` and `-fk`.
|
|
2342
|
+
|
|
2343
|
+
```sh
|
|
2344
|
+
$ dotenvx keychain up -f .env.production -fk .env.keys
|
|
2345
|
+
```
|
|
2346
|
+
|
|
2347
|
+
</details>
|
|
2348
|
+
<details><summary>`keychain down`</summary><br>
|
|
2349
|
+
|
|
2350
|
+
Move a private key from macOS Keychain back into `.env.keys`.
|
|
2351
|
+
|
|
2352
|
+
```sh
|
|
2353
|
+
$ dotenvx keychain down
|
|
2354
|
+
```
|
|
2355
|
+
|
|
2356
|
+
</details>
|
|
2357
|
+
<details><summary>`keychain push`</summary><br>
|
|
2358
|
+
|
|
2359
|
+
Copy a private key from `.env.keys` into macOS Keychain.
|
|
2360
|
+
|
|
2361
|
+
```sh
|
|
2362
|
+
$ dotenvx keychain push
|
|
2363
|
+
```
|
|
2364
|
+
|
|
2365
|
+
</details>
|
|
2366
|
+
<details><summary>`keychain pull`</summary><br>
|
|
2367
|
+
|
|
2368
|
+
Copy a private key from macOS Keychain into `.env.keys`.
|
|
2369
|
+
|
|
2370
|
+
```sh
|
|
2371
|
+
$ dotenvx keychain pull
|
|
2372
|
+
```
|
|
2373
|
+
|
|
2374
|
+
</details>
|
|
2375
|
+
<details><summary>`armor`</summary><br>
|
|
2376
|
+
|
|
2377
|
+
Move private keys into [Dotenvx Armor ⛨](https://dotenvx.com/armor) for off-device storage, sharing with your team, and audited access.
|
|
2378
|
+
|
|
2379
|
+
</details>
|
|
2380
|
+
<details><summary>`armor up`</summary><br>
|
|
2381
|
+
|
|
2382
|
+
Move a private key from `.env.keys` into Dotenvx Armor.
|
|
2383
|
+
|
|
2384
|
+
```sh
|
|
2385
|
+
$ dotenvx login
|
|
2386
|
+
$ dotenvx armor up
|
|
2387
|
+
```
|
|
2388
|
+
|
|
2389
|
+
Specify environment and team.
|
|
2390
|
+
|
|
2391
|
+
```sh
|
|
2392
|
+
$ dotenvx armor up -f .env.production --team acme
|
|
2393
|
+
```
|
|
2394
|
+
|
|
2395
|
+
</details>
|
|
2396
|
+
<details><summary>`armor down`</summary><br>
|
|
2397
|
+
|
|
2398
|
+
Move a private key from Dotenvx Armor back into `.env.keys`.
|
|
2399
|
+
|
|
2400
|
+
```sh
|
|
2401
|
+
$ dotenvx armor down
|
|
2402
|
+
```
|
|
2403
|
+
|
|
2404
|
+
</details>
|
|
2405
|
+
<details><summary>`armor push`</summary><br>
|
|
2406
|
+
|
|
2407
|
+
Copy a private key from `.env.keys` into Dotenvx Armor.
|
|
2408
|
+
|
|
2409
|
+
```sh
|
|
2410
|
+
$ dotenvx armor push
|
|
2411
|
+
```
|
|
2412
|
+
|
|
2413
|
+
</details>
|
|
2414
|
+
<details><summary>`armor pull`</summary><br>
|
|
2415
|
+
|
|
2416
|
+
Copy a private key from Dotenvx Armor into `.env.keys`.
|
|
2417
|
+
|
|
2418
|
+
```sh
|
|
2419
|
+
$ dotenvx armor pull
|
|
2420
|
+
```
|
|
2421
|
+
|
|
2422
|
+
Use a token when running non-interactively.
|
|
2423
|
+
|
|
2424
|
+
```sh
|
|
2425
|
+
$ dotenvx armor pull -f .env.production --token "$DOTENVX_ARMOR_TOKEN"
|
|
2426
|
+
```
|
|
2427
|
+
|
|
2428
|
+
</details>
|
|
2429
|
+
<details><summary>`armor move`</summary><br>
|
|
2430
|
+
|
|
2431
|
+
Move an armored key to another team.
|
|
2432
|
+
|
|
2433
|
+
```sh
|
|
2434
|
+
$ dotenvx armor move --team acme
|
|
2435
|
+
```
|
|
2436
|
+
|
|
2437
|
+
</details>
|
|
2438
|
+
<details><summary>`help`</summary><br>
|
|
2439
|
+
|
|
2440
|
+
Output help for `dotenvx`.
|
|
2441
|
+
|
|
2442
|
+
```sh
|
|
2443
|
+
$ dotenvx help
|
|
2444
|
+
Usage: dotenvx run -- yourcommand
|
|
2445
|
+
|
|
2446
|
+
a secure dotenv–from the creator of `dotenv`
|
|
2447
|
+
|
|
2448
|
+
Options:
|
|
2449
|
+
-l, --log-level <level> set log level (default: "info")
|
|
2450
|
+
-q, --quiet sets log level to error
|
|
2451
|
+
-v, --verbose sets log level to verbose
|
|
2452
|
+
-d, --debug sets log level to debug
|
|
2453
|
+
-V, --version output the version number
|
|
2454
|
+
-h, --help display help for command
|
|
2455
|
+
|
|
2456
|
+
Commands:
|
|
2457
|
+
run inject env at runtime [dotenvx run -- yourcommand]
|
|
2458
|
+
get [KEY] return a single environment variable
|
|
2459
|
+
set <KEY> <value> set a single environment variable
|
|
2460
|
+
encrypt encrypt .env file(s)
|
|
2461
|
+
decrypt decrypt .env file(s)
|
|
2462
|
+
keypair [KEY] print public/private keys for .env file(s)
|
|
2463
|
+
ls [directory] print all .env files in a tree structure
|
|
2464
|
+
genexample [directory]
|
|
2465
|
+
generate .env.example
|
|
2466
|
+
gitignore append to .gitignore
|
|
2467
|
+
precommit [directory]
|
|
2468
|
+
prevent committing .env files to code
|
|
2469
|
+
prebuild [directory]
|
|
2470
|
+
prevent including .env files in docker
|
|
2471
|
+
|
|
2472
|
+
Professional Security:
|
|
2473
|
+
login log in to move keys off-device, share with your team, and audit access
|
|
2474
|
+
logout log out of connected security features
|
|
2475
|
+
armor ⛨ move private keys off-device [www.dotenvx.com/armor]
|
|
2476
|
+
```
|
|
2477
|
+
|
|
2478
|
+
You can get more detailed help per command with `dotenvx help COMMAND`.
|
|
2479
|
+
|
|
2480
|
+
```sh
|
|
2481
|
+
$ dotenvx help run
|
|
2482
|
+
Usage: @dotenvx/dotenvx run [options]
|
|
2483
|
+
|
|
2484
|
+
inject env at runtime [dotenvx run -- yourcommand]
|
|
2485
|
+
|
|
2486
|
+
Options:
|
|
2487
|
+
-e, --env <strings...> environment variable(s) set as string (example: "HELLO=Dotenvx") (default: [])
|
|
2488
|
+
-f, --env-file <paths...> path(s) to your env file(s) (default: [])
|
|
2489
|
+
-fv, --env-vault-file <paths...> path(s) to your .env.vault file(s) (default: [])
|
|
2490
|
+
-o, --overload override existing env variables
|
|
2491
|
+
--convention <name> load a .env convention (available conventions: ['nextjs'])
|
|
2492
|
+
-h, --help display help for command
|
|
2493
|
+
|
|
2494
|
+
Examples:
|
|
2495
|
+
|
|
2496
|
+
$ dotenvx run -- npm run dev
|
|
2497
|
+
$ dotenvx run -- flask --app index run
|
|
2498
|
+
$ dotenvx run -- php artisan serve
|
|
2499
|
+
$ dotenvx run -- bin/rails s
|
|
2500
|
+
|
|
2501
|
+
Try it:
|
|
2502
|
+
|
|
2503
|
+
$ echo "HELLO=Dotenvx" > .env
|
|
2504
|
+
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
|
2505
|
+
|
|
2506
|
+
$ dotenvx run -- node index.js
|
|
2507
|
+
[dotenvx@1.X.X] injecting env (1) from .env
|
|
2508
|
+
Hello Dotenvx
|
|
2509
|
+
```
|
|
2510
|
+
|
|
2511
|
+
</details>
|
|
2512
|
+
<details><summary>`--version`</summary><br>
|
|
2513
|
+
|
|
2514
|
+
Check current version of `dotenvx`.
|
|
2515
|
+
|
|
2516
|
+
```sh
|
|
2517
|
+
$ dotenvx --version
|
|
2518
|
+
X.X.X
|
|
2519
|
+
```
|
|
2520
|
+
|
|
2521
|
+
</details>
|
|
2522
|
+
|
|
2523
|
+
### Utilities
|
|
2524
|
+
|
|
2525
|
+
Additional workflow helpers.
|
|
2526
|
+
|
|
2360
2527
|
<details><summary>`ext scan`</summary><br>
|
|
2361
2528
|
|
|
2362
2529
|
Scan for leaked secrets.
|
|
@@ -2614,8 +2781,6 @@ Turn off [Dotenvx Armor ⛨](https://dotenvx.com/armor) features.
|
|
|
2614
2781
|
require('@dotenvx/dotenvx').config({noArmor: true})
|
|
2615
2782
|
```
|
|
2616
2783
|
|
|
2617
|
-
`noVlt` and `noOps` are deprecated aliases.
|
|
2618
|
-
|
|
2619
2784
|
</details>
|
|
2620
2785
|
<details><summary>`parse(src)`</summary><br>
|
|
2621
2786
|
|
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@ async function decrypt () {
|
|
|
17
17
|
const envs = this.envs
|
|
18
18
|
const sesh = new Session()
|
|
19
19
|
const noArmor = options.armor === false || (await sesh.noArmor())
|
|
20
|
+
const noKeychain = options.keychain === false || options.noKeychain === true
|
|
20
21
|
|
|
21
22
|
let errorCount = 0
|
|
22
23
|
|
|
@@ -30,6 +31,7 @@ async function decrypt () {
|
|
|
30
31
|
ek: options.excludeKey,
|
|
31
32
|
fk: options.envKeysFile,
|
|
32
33
|
noArmor,
|
|
34
|
+
noKeychain,
|
|
33
35
|
onStatus: (text) => {
|
|
34
36
|
if (spinner && text) {
|
|
35
37
|
spinner.text = text
|
|
@@ -64,6 +66,7 @@ async function decrypt () {
|
|
|
64
66
|
ek: options.excludeKey,
|
|
65
67
|
fk: options.envKeysFile,
|
|
66
68
|
noArmor,
|
|
69
|
+
noKeychain,
|
|
67
70
|
onStatus: (text) => {
|
|
68
71
|
if (spinner && text) {
|
|
69
72
|
spinner.text = text
|
|
@@ -21,12 +21,13 @@ async function encryptAction () {
|
|
|
21
21
|
const fk = options.envKeysFile || '.env.keys'
|
|
22
22
|
const noCreate = options.create === false
|
|
23
23
|
const noArmor = options.armor === false || (!options.token && (await sesh.noArmor()))
|
|
24
|
+
const noKeychain = options.keychain === false || options.noKeychain === true
|
|
24
25
|
|
|
25
26
|
let errorCount = 0
|
|
26
27
|
|
|
27
28
|
// stdout - should not have a try so that exit codes can surface to stdout
|
|
28
29
|
if (options.stdout) {
|
|
29
|
-
const { processedEnvs } = await encryptTransform({ envs, ik, ek, fk, noArmor, noCreate })
|
|
30
|
+
const { processedEnvs } = await encryptTransform({ envs, ik, ek, fk, noArmor, noCreate, noKeychain })
|
|
30
31
|
|
|
31
32
|
if (spinner) spinner.stop()
|
|
32
33
|
for (const processedEnv of processedEnvs) {
|
|
@@ -47,7 +48,7 @@ async function encryptAction () {
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
try {
|
|
50
|
-
const { keysSrc, processedEnvs, changedFilepaths, unchangedFilepaths } = await encryptTransform({ envs, ik, ek, fk, noArmor, noCreate })
|
|
51
|
+
const { keysSrc, processedEnvs, changedFilepaths, unchangedFilepaths } = await encryptTransform({ envs, ik, ek, fk, noArmor, noCreate, noKeychain })
|
|
51
52
|
|
|
52
53
|
if (keysSrc) {
|
|
53
54
|
await fsx.writeFileX(fk, keysSrc)
|
package/src/cli/actions/get.js
CHANGED
|
@@ -33,6 +33,7 @@ async function get (key) {
|
|
|
33
33
|
try {
|
|
34
34
|
const sesh = new Session()
|
|
35
35
|
const noArmor = options.armor === false || (await sesh.noArmor())
|
|
36
|
+
const noKeychain = options.keychain === false || options.noKeychain === true
|
|
36
37
|
const { parsed, errors } = await getResolver({
|
|
37
38
|
key,
|
|
38
39
|
envs,
|
|
@@ -40,6 +41,7 @@ async function get (key) {
|
|
|
40
41
|
all: options.all,
|
|
41
42
|
envKeysFile: options.envKeysFile,
|
|
42
43
|
noArmor,
|
|
44
|
+
noKeychain,
|
|
43
45
|
onStatus: (text) => {
|
|
44
46
|
if (spinner && text) {
|
|
45
47
|
spinner.text = text
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const { logger } = require('../../../shared/logger')
|
|
2
|
+
const KeychainDown = require('./../../../lib/services/keychainDown')
|
|
3
|
+
const createSpinner = require('../../../lib/helpers/createSpinner')
|
|
4
|
+
const armoredKeyDisplay = require('../../../lib/helpers/armoredKeyDisplay')
|
|
5
|
+
|
|
6
|
+
async function down () {
|
|
7
|
+
const options = this.opts()
|
|
8
|
+
const spinner = await createSpinner({ ...options, text: 'unkeychaining' })
|
|
9
|
+
|
|
10
|
+
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
const { changed, privateKeyName, publicKeyValue } = new KeychainDown(options.envFile, options.envKeysFile).run()
|
|
14
|
+
const keyDisplay = armoredKeyDisplay(publicKeyValue) || privateKeyName
|
|
15
|
+
|
|
16
|
+
if (spinner) spinner.stop()
|
|
17
|
+
if (changed) {
|
|
18
|
+
logger.success(`◇ moved to .env.keys (${keyDisplay})`)
|
|
19
|
+
} else {
|
|
20
|
+
logger.info(`○ no change (${keyDisplay})`)
|
|
21
|
+
}
|
|
22
|
+
} catch (error) {
|
|
23
|
+
if (spinner) spinner.stop()
|
|
24
|
+
logger.error(error.message)
|
|
25
|
+
process.exit(1)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = down
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const { logger } = require('../../../shared/logger')
|
|
2
|
+
const KeychainPull = require('./../../../lib/services/keychainPull')
|
|
3
|
+
const createSpinner = require('../../../lib/helpers/createSpinner')
|
|
4
|
+
const armoredKeyDisplay = require('../../../lib/helpers/armoredKeyDisplay')
|
|
5
|
+
|
|
6
|
+
async function pull () {
|
|
7
|
+
const options = this.opts()
|
|
8
|
+
const spinner = await createSpinner({ ...options, text: 'pulling' })
|
|
9
|
+
|
|
10
|
+
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
const { changed, privateKeyName, publicKeyValue } = new KeychainPull(options.envFile, options.envKeysFile).run()
|
|
14
|
+
const keyDisplay = armoredKeyDisplay(publicKeyValue) || privateKeyName
|
|
15
|
+
|
|
16
|
+
if (spinner) spinner.stop()
|
|
17
|
+
if (changed) {
|
|
18
|
+
logger.success(`◇ pulled to .env.keys (${keyDisplay})`)
|
|
19
|
+
} else {
|
|
20
|
+
logger.info(`○ no change (${keyDisplay})`)
|
|
21
|
+
}
|
|
22
|
+
} catch (error) {
|
|
23
|
+
if (spinner) spinner.stop()
|
|
24
|
+
logger.error(error.message)
|
|
25
|
+
process.exit(1)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = pull
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const { logger } = require('../../../shared/logger')
|
|
2
|
+
const KeychainPush = require('./../../../lib/services/keychainPush')
|
|
3
|
+
const createSpinner = require('../../../lib/helpers/createSpinner')
|
|
4
|
+
const armoredKeyDisplay = require('../../../lib/helpers/armoredKeyDisplay')
|
|
5
|
+
|
|
6
|
+
async function push () {
|
|
7
|
+
const options = this.opts()
|
|
8
|
+
const spinner = await createSpinner({ ...options, text: 'pushing' })
|
|
9
|
+
|
|
10
|
+
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
const { changed, privateKeyName, publicKeyValue } = new KeychainPush(options.envFile, options.envKeysFile).run()
|
|
14
|
+
const keyDisplay = armoredKeyDisplay(publicKeyValue) || privateKeyName
|
|
15
|
+
|
|
16
|
+
if (spinner) spinner.stop()
|
|
17
|
+
if (changed) {
|
|
18
|
+
logger.success(`⌥ pushed (${keyDisplay})`)
|
|
19
|
+
} else {
|
|
20
|
+
logger.info(`○ no change (${keyDisplay})`)
|
|
21
|
+
}
|
|
22
|
+
} catch (error) {
|
|
23
|
+
if (spinner) spinner.stop()
|
|
24
|
+
logger.error(error.message)
|
|
25
|
+
process.exit(1)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = push
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const { logger } = require('../../../shared/logger')
|
|
2
|
+
const KeychainUp = require('./../../../lib/services/keychainUp')
|
|
3
|
+
const createSpinner = require('../../../lib/helpers/createSpinner')
|
|
4
|
+
const armoredKeyDisplay = require('../../../lib/helpers/armoredKeyDisplay')
|
|
5
|
+
|
|
6
|
+
async function up () {
|
|
7
|
+
const options = this.opts()
|
|
8
|
+
const spinner = await createSpinner({ ...options, text: 'keychaining' })
|
|
9
|
+
|
|
10
|
+
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
const { changed, privateKeyName, publicKeyValue } = new KeychainUp(options.envFile, options.envKeysFile).run()
|
|
14
|
+
const keyDisplay = armoredKeyDisplay(publicKeyValue) || privateKeyName
|
|
15
|
+
|
|
16
|
+
if (spinner) spinner.stop()
|
|
17
|
+
if (changed) {
|
|
18
|
+
logger.success(`⌥ keychained (${keyDisplay})`)
|
|
19
|
+
} else {
|
|
20
|
+
logger.info(`○ no change (${keyDisplay})`)
|
|
21
|
+
}
|
|
22
|
+
} catch (error) {
|
|
23
|
+
if (spinner) spinner.stop()
|
|
24
|
+
logger.error(error.message)
|
|
25
|
+
process.exit(1)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = up
|
|
@@ -21,6 +21,7 @@ async function keypair (key) {
|
|
|
21
21
|
envFile: options.envFile,
|
|
22
22
|
envKeysFile: options.envKeysFile,
|
|
23
23
|
armor: options.armor,
|
|
24
|
+
noKeychain: options.keychain === false || options.noKeychain === true,
|
|
24
25
|
token: options.token,
|
|
25
26
|
command: process.argv.slice(2),
|
|
26
27
|
onStatus: (text) => {
|