@dotenvx/dotenvx 1.69.2 → 1.71.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -1
- package/README.md +29 -14
- package/package.json +7 -6
- package/src/cli/actions/decrypt.js +5 -5
- package/src/cli/actions/encrypt.js +13 -13
- package/src/cli/actions/get.js +4 -4
- package/src/cli/actions/keypair.js +4 -4
- package/src/cli/actions/normalizeArmorOptions.js +11 -0
- package/src/cli/actions/rotate.js +5 -5
- package/src/cli/actions/run.js +5 -4
- package/src/cli/actions/set.js +4 -4
- package/src/cli/commands/ext.js +1 -1
- package/src/cli/dotenvx.js +31 -33
- package/src/db/session.js +9 -9
- package/src/lib/extensions/{vlt.js → armor.js} +4 -4
- package/src/lib/helpers/cryptography/{vltKeypair.js → armorKeypair.js} +4 -4
- package/src/lib/helpers/cryptography/armorKeypairSync.js +14 -0
- package/src/lib/helpers/cryptography/index.js +2 -2
- package/src/lib/helpers/cryptography/mutateKeysSrc.js +1 -1
- package/src/lib/helpers/cryptography/mutateKeysSrcSync.js +1 -1
- package/src/lib/helpers/cryptography/provision.js +8 -8
- package/src/lib/helpers/cryptography/provisionSync.js +6 -6
- package/src/lib/helpers/cryptography/provisionWithPrivateKey.js +1 -1
- package/src/lib/helpers/executeDynamic.js +41 -12
- package/src/lib/helpers/keyResolution/keyValues.js +10 -6
- package/src/lib/helpers/keyResolution/keyValuesFromEnvSrc.js +9 -5
- package/src/lib/helpers/keyResolution/keyValuesSync.js +11 -8
- package/src/lib/main.d.ts +44 -13
- package/src/lib/main.js +13 -12
- package/src/lib/services/decrypt.js +4 -4
- package/src/lib/services/encrypt.js +4 -4
- package/src/lib/services/get.js +4 -4
- package/src/lib/services/keypair.js +4 -4
- package/src/lib/services/rotate.js +9 -9
- package/src/lib/services/run.js +12 -9
- package/src/lib/services/sets.js +6 -6
- package/src/cli/actions/normalizeVltOptions.js +0 -10
- package/src/lib/helpers/cryptography/vltKeypairSync.js +0 -14
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/v1.
|
|
5
|
+
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.71.0...main)
|
|
6
|
+
|
|
7
|
+
## [1.71.0](https://github.com/dotenvx/dotenvx/compare/v1.70.0...v1.71.0) (2026-06-01)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
* Add optional automation `--token` support for Armor ⛨ users ([#831](https://github.com/dotenvx/dotenvx/pull/831))
|
|
12
|
+
|
|
13
|
+
## [1.70.0](https://github.com/dotenvx/dotenvx/compare/v1.69.2...v1.70.0) (2026-05-31)
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
* Dotenvx Ops/Vlt is now Dotenvx Armor ⛨ ([#830](https://github.com/dotenvx/dotenvx/pull/830))
|
|
6
18
|
|
|
7
19
|
## [1.69.2](https://github.com/dotenvx/dotenvx/compare/v1.69.1...v1.69.2) (2026-05-29)
|
|
8
20
|
|
package/README.md
CHANGED
|
@@ -1287,14 +1287,25 @@ $ dotenvx run -fk .env.keys -f apps/app1/.env -- yourcommand
|
|
|
1287
1287
|
```
|
|
1288
1288
|
|
|
1289
1289
|
</details>
|
|
1290
|
-
<details><summary>`run --
|
|
1290
|
+
<details><summary>`run --token`</summary><br>
|
|
1291
1291
|
|
|
1292
|
-
|
|
1292
|
+
Set Armor ⛨ token for retrieving armored private keys.
|
|
1293
1293
|
|
|
1294
1294
|
```sh
|
|
1295
|
-
$ dotenvx run --
|
|
1295
|
+
$ dotenvx run --token "$DOTENVX_ARMOR_TOKEN" -- yourcommand
|
|
1296
1296
|
```
|
|
1297
1297
|
|
|
1298
|
+
</details>
|
|
1299
|
+
<details><summary>`run --no-armor`</summary><br>
|
|
1300
|
+
|
|
1301
|
+
Turn off [Dotenvx Armor ⛨](https://dotenvx.com/armor) features.
|
|
1302
|
+
|
|
1303
|
+
```sh
|
|
1304
|
+
$ dotenvx run --no-armor -- yourcommand
|
|
1305
|
+
```
|
|
1306
|
+
|
|
1307
|
+
`--no-vlt` and `--no-ops` are deprecated aliases.
|
|
1308
|
+
|
|
1298
1309
|
</details>
|
|
1299
1310
|
<details><summary>`get KEY`</summary><br>
|
|
1300
1311
|
|
|
@@ -1622,15 +1633,17 @@ $ dotenvx encrypt -f .env.production
|
|
|
1622
1633
|
```
|
|
1623
1634
|
|
|
1624
1635
|
</details>
|
|
1625
|
-
<details><summary>`encrypt --no-
|
|
1636
|
+
<details><summary>`encrypt --no-armor`</summary><br>
|
|
1626
1637
|
|
|
1627
|
-
Turn off [Dotenvx
|
|
1638
|
+
Turn off [Dotenvx Armor ⛨](https://dotenvx.com/armor) features for encrypt.
|
|
1628
1639
|
|
|
1629
1640
|
```sh
|
|
1630
|
-
$ dotenvx encrypt --no-
|
|
1641
|
+
$ dotenvx encrypt --no-armor
|
|
1631
1642
|
◈ encrypted (.env)
|
|
1632
1643
|
```
|
|
1633
1644
|
|
|
1645
|
+
`--no-vlt` and `--no-ops` are deprecated aliases.
|
|
1646
|
+
|
|
1634
1647
|
</details>
|
|
1635
1648
|
<details><summary>`encrypt -fk`</summary><br>
|
|
1636
1649
|
|
|
@@ -2548,15 +2561,17 @@ $ dotenvx run --convention=nextjs -- node index.js
|
|
|
2548
2561
|
```
|
|
2549
2562
|
|
|
2550
2563
|
</details>
|
|
2551
|
-
<details><summary>`config(
|
|
2564
|
+
<details><summary>`config(noArmor:)` - noArmor</summary><br>
|
|
2552
2565
|
|
|
2553
|
-
Turn off [Dotenvx
|
|
2566
|
+
Turn off [Dotenvx Armor ⛨](https://dotenvx.com/armor) features.
|
|
2554
2567
|
|
|
2555
2568
|
```js
|
|
2556
2569
|
// index.js
|
|
2557
|
-
require('@dotenvx/dotenvx').config({
|
|
2570
|
+
require('@dotenvx/dotenvx').config({noArmor: true})
|
|
2558
2571
|
```
|
|
2559
2572
|
|
|
2573
|
+
`noVlt` and `noOps` are deprecated aliases.
|
|
2574
|
+
|
|
2560
2575
|
</details>
|
|
2561
2576
|
<details><summary>`parse(src)`</summary><br>
|
|
2562
2577
|
|
|
@@ -2650,17 +2665,17 @@ This is known as *Decryption at Access* and is written about in [the whitepaper]
|
|
|
2650
2665
|
|
|
2651
2666
|
|
|
2652
2667
|
|
|
2653
|
-
##
|
|
2668
|
+
## Armor ⛨
|
|
2654
2669
|
|
|
2655
|
-
[](https://dotenvx.com/armor)
|
|
2656
2671
|
|
|
2657
2672
|
```
|
|
2658
2673
|
⛨ ARMORED KEYS: Harden your private keys.
|
|
2659
|
-
⮕ install [curl -sfS https://dotenvx.sh/
|
|
2660
|
-
⮕ then run [dotenvx
|
|
2674
|
+
⮕ install [curl -sfS https://dotenvx.sh/armor | sh]
|
|
2675
|
+
⮕ then run [dotenvx armor login]
|
|
2661
2676
|
```
|
|
2662
2677
|
|
|
2663
|
-
[Learn more](https://dotenvx.com/
|
|
2678
|
+
[Learn more](https://dotenvx.com/armor)
|
|
2664
2679
|
|
|
2665
2680
|
|
|
2666
2681
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.71.0",
|
|
3
3
|
"name": "@dotenvx/dotenvx",
|
|
4
|
-
"description": "
|
|
4
|
+
"description": "a secure dotenv–from the creator of `dotenv`",
|
|
5
5
|
"author": "@motdotla",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"dotenv",
|
|
@@ -35,11 +35,12 @@
|
|
|
35
35
|
"scripts": {
|
|
36
36
|
"standard": "standard",
|
|
37
37
|
"standard:fix": "standard --fix",
|
|
38
|
-
"test": "tap run --test-env=
|
|
39
|
-
"test-coverage": "tap run --test-env=
|
|
38
|
+
"test": "tap run --test-env=DOTENVX_NO_ARMOR=true --allow-empty-coverage --disable-coverage --timeout=60000",
|
|
39
|
+
"test-coverage": "tap run --test-env=DOTENVX_NO_ARMOR=true --show-full-coverage --timeout=60000",
|
|
40
40
|
"testshell": "bash shellspec",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
41
|
+
"release:check": "npm test && npm run testshell",
|
|
42
|
+
"prerelease": "npm run release:check",
|
|
43
|
+
"release": "npm run release:check && standard-version"
|
|
43
44
|
},
|
|
44
45
|
"funding": "https://dotenvx.com",
|
|
45
46
|
"dependencies": {
|
|
@@ -5,17 +5,17 @@ const Decrypt = require('./../../lib/services/decrypt')
|
|
|
5
5
|
const catchAndLog = require('../../lib/helpers/catchAndLog')
|
|
6
6
|
const createSpinner = require('../../lib/helpers/createSpinner')
|
|
7
7
|
const Session = require('../../db/session')
|
|
8
|
-
const
|
|
8
|
+
const normalizeArmorOptions = require('./normalizeArmorOptions')
|
|
9
9
|
|
|
10
10
|
async function decrypt () {
|
|
11
|
-
const options =
|
|
11
|
+
const options = normalizeArmorOptions(this.opts())
|
|
12
12
|
const spinner = await createSpinner({ ...options, text: 'decrypting' })
|
|
13
13
|
|
|
14
14
|
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
15
15
|
|
|
16
16
|
const sesh = new Session()
|
|
17
17
|
const envs = this.envs
|
|
18
|
-
const
|
|
18
|
+
const noArmor = options.armor === false || (await sesh.noArmor())
|
|
19
19
|
|
|
20
20
|
let errorCount = 0
|
|
21
21
|
|
|
@@ -23,7 +23,7 @@ async function decrypt () {
|
|
|
23
23
|
if (options.stdout) {
|
|
24
24
|
const {
|
|
25
25
|
processedEnvs
|
|
26
|
-
} = await new Decrypt(envs, options.key, options.excludeKey, options.envKeysFile,
|
|
26
|
+
} = await new Decrypt(envs, options.key, options.excludeKey, options.envKeysFile, noArmor).run()
|
|
27
27
|
if (spinner) spinner.stop()
|
|
28
28
|
for (const processedEnv of processedEnvs) {
|
|
29
29
|
if (processedEnv.error) {
|
|
@@ -45,7 +45,7 @@ async function decrypt () {
|
|
|
45
45
|
processedEnvs,
|
|
46
46
|
changedFilepaths,
|
|
47
47
|
unchangedFilepaths
|
|
48
|
-
} = await new Decrypt(envs, options.key, options.excludeKey, options.envKeysFile,
|
|
48
|
+
} = await new Decrypt(envs, options.key, options.excludeKey, options.envKeysFile, noArmor).run()
|
|
49
49
|
|
|
50
50
|
for (const processedEnv of processedEnvs) {
|
|
51
51
|
logger.verbose(`decrypting ${processedEnv.envFilepath} (${processedEnv.filepath})`)
|
|
@@ -7,22 +7,22 @@ const catchAndLog = require('../../lib/helpers/catchAndLog')
|
|
|
7
7
|
const createSpinner = require('../../lib/helpers/createSpinner')
|
|
8
8
|
const prompts = require('../../lib/helpers/prompts')
|
|
9
9
|
const Session = require('../../db/session')
|
|
10
|
-
const
|
|
10
|
+
const normalizeArmorOptions = require('./normalizeArmorOptions')
|
|
11
11
|
|
|
12
12
|
function keypairSpinnerHooks (spinner) {
|
|
13
|
-
let
|
|
13
|
+
let stoppedForArmor = false
|
|
14
14
|
|
|
15
15
|
return {
|
|
16
16
|
onStderr: () => {
|
|
17
|
-
if (spinner && !
|
|
17
|
+
if (spinner && !stoppedForArmor) {
|
|
18
18
|
spinner.stop()
|
|
19
|
-
|
|
19
|
+
stoppedForArmor = true
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
after: () => {
|
|
23
|
-
if (spinner &&
|
|
23
|
+
if (spinner && stoppedForArmor) {
|
|
24
24
|
spinner.start('encrypting')
|
|
25
|
-
|
|
25
|
+
stoppedForArmor = false
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -39,7 +39,7 @@ function keyStorageSelector (spinner) {
|
|
|
39
39
|
message: 'Choose private key storage',
|
|
40
40
|
choices: [
|
|
41
41
|
{ name: '◫ File (.env.keys)', value: 'file' },
|
|
42
|
-
{ name: '⛨ Armor (
|
|
42
|
+
{ name: '⛨ Armor (armor.dotenvx.com)', value: 'armored' }
|
|
43
43
|
]
|
|
44
44
|
}, {
|
|
45
45
|
input: process.stdin,
|
|
@@ -51,12 +51,12 @@ function keyStorageSelector (spinner) {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
function encryptOptions (spinner,
|
|
54
|
+
function encryptOptions (spinner, noArmor) {
|
|
55
55
|
const options = {
|
|
56
56
|
keypairHooks: keypairSpinnerHooks(spinner)
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
if (!
|
|
59
|
+
if (!noArmor) {
|
|
60
60
|
options.selectKeyStorage = keyStorageSelector(spinner)
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -64,21 +64,21 @@ function encryptOptions (spinner, noVlt) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
async function encrypt () {
|
|
67
|
-
const options =
|
|
67
|
+
const options = normalizeArmorOptions(this.opts())
|
|
68
68
|
const spinner = await createSpinner({ ...options, text: 'encrypting' })
|
|
69
69
|
|
|
70
70
|
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
71
71
|
|
|
72
72
|
const sesh = new Session()
|
|
73
73
|
const envs = this.envs
|
|
74
|
-
const
|
|
74
|
+
const noArmor = options.armor === false || (!options.token && (await sesh.noArmor()))
|
|
75
75
|
const noCreate = options.create === false
|
|
76
76
|
|
|
77
77
|
// stdout - should not have a try so that exit codes can surface to stdout
|
|
78
78
|
if (options.stdout) {
|
|
79
79
|
const {
|
|
80
80
|
processedEnvs
|
|
81
|
-
} = await new Encrypt(envs, options.key, options.excludeKey, options.envKeysFile,
|
|
81
|
+
} = await new Encrypt(envs, options.key, options.excludeKey, options.envKeysFile, noArmor, noCreate, options.token, encryptOptions(spinner, noArmor)).run()
|
|
82
82
|
if (spinner) spinner.stop()
|
|
83
83
|
for (const processedEnv of processedEnvs) {
|
|
84
84
|
console.log(processedEnv.envSrc)
|
|
@@ -90,7 +90,7 @@ async function encrypt () {
|
|
|
90
90
|
processedEnvs,
|
|
91
91
|
changedFilepaths,
|
|
92
92
|
unchangedFilepaths
|
|
93
|
-
} = await new Encrypt(envs, options.key, options.excludeKey, options.envKeysFile,
|
|
93
|
+
} = await new Encrypt(envs, options.key, options.excludeKey, options.envKeysFile, noArmor, noCreate, options.token, encryptOptions(spinner, noArmor)).run()
|
|
94
94
|
|
|
95
95
|
for (const processedEnv of processedEnvs) {
|
|
96
96
|
logger.verbose(`encrypting ${processedEnv.envFilepath} (${processedEnv.filepath})`)
|
package/src/cli/actions/get.js
CHANGED
|
@@ -6,10 +6,10 @@ const catchAndLog = require('./../../lib/helpers/catchAndLog')
|
|
|
6
6
|
const createSpinner = require('../../lib/helpers/createSpinner')
|
|
7
7
|
const Session = require('../../db/session')
|
|
8
8
|
const Get = require('./../../lib/services/get')
|
|
9
|
-
const
|
|
9
|
+
const normalizeArmorOptions = require('./normalizeArmorOptions')
|
|
10
10
|
|
|
11
11
|
async function get (key) {
|
|
12
|
-
const options =
|
|
12
|
+
const options = normalizeArmorOptions(this.opts())
|
|
13
13
|
const spinner = await createSpinner({ ...options, text: 'decrypting' })
|
|
14
14
|
|
|
15
15
|
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
@@ -30,8 +30,8 @@ async function get (key) {
|
|
|
30
30
|
|
|
31
31
|
try {
|
|
32
32
|
const sesh = new Session()
|
|
33
|
-
const
|
|
34
|
-
const { parsed, errors } = await new Get(key, envs, options.overload, options.all, options.envKeysFile,
|
|
33
|
+
const noArmor = options.armor === false || (await sesh.noArmor())
|
|
34
|
+
const { parsed, errors } = await new Get(key, envs, options.overload, options.all, options.envKeysFile, noArmor).run()
|
|
35
35
|
|
|
36
36
|
for (const error of errors || []) {
|
|
37
37
|
if (options.strict) throw error // throw immediately if strict
|
|
@@ -3,10 +3,10 @@ const { logger } = require('./../../shared/logger')
|
|
|
3
3
|
const Keypair = require('./../../lib/services/keypair')
|
|
4
4
|
const createSpinner = require('../../lib/helpers/createSpinner')
|
|
5
5
|
const Session = require('../../db/session')
|
|
6
|
-
const
|
|
6
|
+
const normalizeArmorOptions = require('./normalizeArmorOptions')
|
|
7
7
|
|
|
8
8
|
async function keypair (key) {
|
|
9
|
-
const options =
|
|
9
|
+
const options = normalizeArmorOptions(this.opts())
|
|
10
10
|
const spinner = await createSpinner({ ...options, text: 'retrieving' })
|
|
11
11
|
|
|
12
12
|
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
@@ -17,8 +17,8 @@ async function keypair (key) {
|
|
|
17
17
|
const prettyPrint = options.prettyPrint || options.pp
|
|
18
18
|
|
|
19
19
|
const sesh = new Session()
|
|
20
|
-
const
|
|
21
|
-
const keypairs = await new Keypair(options.envFile, options.envKeysFile,
|
|
20
|
+
const noArmor = options.armor === false || await sesh.noArmor()
|
|
21
|
+
const keypairs = await new Keypair(options.envFile, options.envKeysFile, noArmor).run()
|
|
22
22
|
const results = key ? keypairs[key] : keypairs
|
|
23
23
|
|
|
24
24
|
if (spinner) spinner.stop()
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function normalizeArmorOptions (options) {
|
|
2
|
+
if (options.armor === false || options.ops === false || options.vlt === false) {
|
|
3
|
+
options.armor = false
|
|
4
|
+
options.ops = false
|
|
5
|
+
options.vlt = false
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return options
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
module.exports = normalizeArmorOptions
|
|
@@ -6,23 +6,23 @@ const Rotate = require('./../../lib/services/rotate')
|
|
|
6
6
|
const catchAndLog = require('../../lib/helpers/catchAndLog')
|
|
7
7
|
const createSpinner = require('../../lib/helpers/createSpinner')
|
|
8
8
|
const Session = require('../../db/session')
|
|
9
|
-
const
|
|
9
|
+
const normalizeArmorOptions = require('./normalizeArmorOptions')
|
|
10
10
|
|
|
11
11
|
async function rotate () {
|
|
12
|
-
const options =
|
|
12
|
+
const options = normalizeArmorOptions(this.opts())
|
|
13
13
|
const spinner = await createSpinner({ ...options, text: 'rotating', frames: ['⟳', '⤾', '⥁'] })
|
|
14
14
|
|
|
15
15
|
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
16
16
|
|
|
17
17
|
const envs = this.envs
|
|
18
18
|
const sesh = new Session()
|
|
19
|
-
const
|
|
19
|
+
const noArmor = options.armor === false || (await sesh.noArmor())
|
|
20
20
|
|
|
21
21
|
// stdout - should not have a try so that exit codes can surface to stdout
|
|
22
22
|
if (options.stdout) {
|
|
23
23
|
const {
|
|
24
24
|
processedEnvs
|
|
25
|
-
} = await new Rotate(envs, options.key, options.excludeKey, options.envKeysFile,
|
|
25
|
+
} = await new Rotate(envs, options.key, options.excludeKey, options.envKeysFile, noArmor).run()
|
|
26
26
|
if (spinner) spinner.stop()
|
|
27
27
|
for (const processedEnv of processedEnvs) {
|
|
28
28
|
console.log(processedEnv.envSrc)
|
|
@@ -38,7 +38,7 @@ async function rotate () {
|
|
|
38
38
|
processedEnvs,
|
|
39
39
|
changedFilepaths,
|
|
40
40
|
unchangedFilepaths
|
|
41
|
-
} = await new Rotate(envs, options.key, options.excludeKey, options.envKeysFile,
|
|
41
|
+
} = await new Rotate(envs, options.key, options.excludeKey, options.envKeysFile, noArmor).run()
|
|
42
42
|
|
|
43
43
|
for (const processedEnv of processedEnvs) {
|
|
44
44
|
logger.verbose(`rotating ${processedEnv.envFilepath} (${processedEnv.filepath})`)
|
package/src/cli/actions/run.js
CHANGED
|
@@ -6,13 +6,13 @@ const Run = require('./../../lib/services/run')
|
|
|
6
6
|
const catchAndLog = require('./../../lib/helpers/catchAndLog')
|
|
7
7
|
const createSpinner = require('../../lib/helpers/createSpinner')
|
|
8
8
|
const Session = require('../../db/session')
|
|
9
|
-
const
|
|
9
|
+
const normalizeArmorOptions = require('./normalizeArmorOptions')
|
|
10
10
|
|
|
11
11
|
const conventions = require('./../../lib/helpers/conventions')
|
|
12
12
|
const { determine } = require('./../../lib/helpers/envResolution')
|
|
13
13
|
|
|
14
14
|
async function run () {
|
|
15
|
-
const options =
|
|
15
|
+
const options = normalizeArmorOptions(this.opts())
|
|
16
16
|
const commandArgs = this.args
|
|
17
17
|
const spinner = await createSpinner({ ...options, text: 'injecting' })
|
|
18
18
|
|
|
@@ -22,7 +22,7 @@ async function run () {
|
|
|
22
22
|
const ignore = options.ignore || []
|
|
23
23
|
|
|
24
24
|
const sesh = new Session()
|
|
25
|
-
const
|
|
25
|
+
const noArmor = options.armor === false || (!options.token && (await sesh.noArmor()))
|
|
26
26
|
|
|
27
27
|
if (commandArgs.length < 1) {
|
|
28
28
|
if (spinner) spinner.stop()
|
|
@@ -54,7 +54,8 @@ async function run () {
|
|
|
54
54
|
readableStrings,
|
|
55
55
|
readableFilepaths,
|
|
56
56
|
uniqueInjectedKeys
|
|
57
|
-
} = await new Run(envs, options.overload, process.env, options.envKeysFile,
|
|
57
|
+
} = await new Run(envs, options.overload, process.env, options.envKeysFile, noArmor, {
|
|
58
|
+
token: options.token,
|
|
58
59
|
keypairHooks: {
|
|
59
60
|
after: () => {
|
|
60
61
|
if (spinner) spinner.start('injecting')
|
package/src/cli/actions/set.js
CHANGED
|
@@ -5,10 +5,10 @@ const catchAndLog = require('../../lib/helpers/catchAndLog')
|
|
|
5
5
|
const createSpinner = require('../../lib/helpers/createSpinner')
|
|
6
6
|
const Session = require('../../db/session')
|
|
7
7
|
const Sets = require('./../../lib/services/sets')
|
|
8
|
-
const
|
|
8
|
+
const normalizeArmorOptions = require('./normalizeArmorOptions')
|
|
9
9
|
|
|
10
10
|
async function set (key, value) {
|
|
11
|
-
const options =
|
|
11
|
+
const options = normalizeArmorOptions(this.opts())
|
|
12
12
|
|
|
13
13
|
let encrypt = true
|
|
14
14
|
let settingMessage = 'encrypting'
|
|
@@ -27,14 +27,14 @@ async function set (key, value) {
|
|
|
27
27
|
const sesh = new Session()
|
|
28
28
|
const envs = this.envs
|
|
29
29
|
const envKeysFilepath = options.envKeysFile
|
|
30
|
-
const
|
|
30
|
+
const noArmor = options.armor === false || (await sesh.noArmor())
|
|
31
31
|
const noCreate = options.create === false
|
|
32
32
|
|
|
33
33
|
const {
|
|
34
34
|
processedEnvs,
|
|
35
35
|
changedFilepaths,
|
|
36
36
|
unchangedFilepaths
|
|
37
|
-
} = await new Sets(key, value, envs, encrypt, envKeysFilepath,
|
|
37
|
+
} = await new Sets(key, value, envs, encrypt, envKeysFilepath, noArmor, noCreate).run()
|
|
38
38
|
|
|
39
39
|
let withEncryption = ''
|
|
40
40
|
|
package/src/cli/commands/ext.js
CHANGED
package/src/cli/dotenvx.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/* c8 ignore start */
|
|
4
|
-
const { Command } = require('commander')
|
|
4
|
+
const { Command, Option } = require('commander')
|
|
5
5
|
const program = new Command()
|
|
6
6
|
|
|
7
7
|
const { setLogLevel, logger } = require('../shared/logger')
|
|
@@ -43,7 +43,7 @@ program
|
|
|
43
43
|
setLogLevel(options)
|
|
44
44
|
})
|
|
45
45
|
|
|
46
|
-
// for dynamic loading of dotenvx-
|
|
46
|
+
// for dynamic loading of dotenvx-armor, etc
|
|
47
47
|
program
|
|
48
48
|
.argument('[command]', 'dynamic command')
|
|
49
49
|
.argument('[args...]', 'dynamic command arguments')
|
|
@@ -70,8 +70,10 @@ program.command('run')
|
|
|
70
70
|
.option('--strict', 'process.exit(1) on any errors', false)
|
|
71
71
|
.option('--convention <name>', 'load a .env convention (available conventions: [\'nextjs\', \'flow\'])')
|
|
72
72
|
.option('--ignore <errorCodes...>', 'error code(s) to ignore (example: --ignore=MISSING_ENV_FILE)')
|
|
73
|
-
.option('--
|
|
74
|
-
.option('--no-
|
|
73
|
+
.option('--token <token>', 'set Armor ⛨ token')
|
|
74
|
+
.option('--no-armor', 'disable dotenvx-armor features')
|
|
75
|
+
.addOption(new Option('--no-vlt', 'disable dotenvx-vlt features (deprecated. use --no-armor)').hideHelp())
|
|
76
|
+
.addOption(new Option('--no-ops', 'disable dotenvx-ops features (deprecated. use --no-armor)').hideHelp())
|
|
75
77
|
.action(function (...args) {
|
|
76
78
|
this.envs = envs
|
|
77
79
|
return require('./actions/run').apply(this, args)
|
|
@@ -93,8 +95,9 @@ program.command('get')
|
|
|
93
95
|
.option('-pp, --pretty-print', 'pretty print output')
|
|
94
96
|
.option('--pp', 'pretty print output (alias)')
|
|
95
97
|
.option('--format <type>', 'format of the output (json, shell, colon, eval)', 'json')
|
|
96
|
-
.option('--no-
|
|
97
|
-
.
|
|
98
|
+
.option('--no-armor', 'disable dotenvx-armor features')
|
|
99
|
+
.addOption(new Option('--no-vlt', 'disable dotenvx-vlt features (deprecated. use --no-armor)').hideHelp())
|
|
100
|
+
.addOption(new Option('--no-ops', 'disable dotenvx-ops features (deprecated. use --no-armor)').hideHelp())
|
|
98
101
|
.action(function (...args) {
|
|
99
102
|
this.envs = envs
|
|
100
103
|
return require('./actions/get').apply(this, args)
|
|
@@ -113,8 +116,9 @@ program.command('set')
|
|
|
113
116
|
.option('-c, --encrypt', 'encrypt value', true)
|
|
114
117
|
.option('-p, --plain', 'store value as plain text', false)
|
|
115
118
|
.option('--no-create', 'do not create .env file(s) when missing')
|
|
116
|
-
.option('--no-
|
|
117
|
-
.
|
|
119
|
+
.option('--no-armor', 'disable dotenvx-armor features')
|
|
120
|
+
.addOption(new Option('--no-vlt', 'disable dotenvx-vlt features (deprecated. use --no-armor)').hideHelp())
|
|
121
|
+
.addOption(new Option('--no-ops', 'disable dotenvx-ops features (deprecated. use --no-armor)').hideHelp())
|
|
118
122
|
.action(function (...args) {
|
|
119
123
|
this.envs = envs
|
|
120
124
|
return require('./actions/set').apply(this, args)
|
|
@@ -128,10 +132,11 @@ program.command('encrypt')
|
|
|
128
132
|
.option('-k, --key <keys...>', 'keys(s) to encrypt (default: all keys in file)')
|
|
129
133
|
.option('-ek, --exclude-key <excludeKeys...>', 'keys(s) to exclude from encryption (default: none)')
|
|
130
134
|
.option('--stdout', 'send to stdout')
|
|
131
|
-
.option('--token <token>', 'set
|
|
135
|
+
.option('--token <token>', 'set Armor ⛨ token')
|
|
132
136
|
.option('--no-create', 'do not create .env file(s) when missing')
|
|
133
|
-
.option('--no-
|
|
134
|
-
.
|
|
137
|
+
.option('--no-armor', 'disable dotenvx-armor features')
|
|
138
|
+
.addOption(new Option('--no-vlt', 'disable dotenvx-vlt features (deprecated. use --no-armor)').hideHelp())
|
|
139
|
+
.addOption(new Option('--no-ops', 'disable dotenvx-ops features (deprecated. use --no-armor)').hideHelp())
|
|
135
140
|
.action(function (...args) {
|
|
136
141
|
this.envs = envs
|
|
137
142
|
return require('./actions/encrypt').apply(this, args)
|
|
@@ -144,8 +149,9 @@ program.command('decrypt')
|
|
|
144
149
|
.option('-fk, --env-keys-file <path>', 'path to your .env.keys file (default: same path as your env file)')
|
|
145
150
|
.option('-k, --key <keys...>', 'keys(s) to decrypt (default: all keys in file)')
|
|
146
151
|
.option('-ek, --exclude-key <excludeKeys...>', 'keys(s) to exclude from decryption (default: none)')
|
|
147
|
-
.option('--no-
|
|
148
|
-
.
|
|
152
|
+
.option('--no-armor', 'disable dotenvx-armor features')
|
|
153
|
+
.addOption(new Option('--no-vlt', 'disable dotenvx-vlt features (deprecated. use --no-armor)').hideHelp())
|
|
154
|
+
.addOption(new Option('--no-ops', 'disable dotenvx-ops features (deprecated. use --no-armor)').hideHelp())
|
|
149
155
|
.option('--stdout', 'send to stdout')
|
|
150
156
|
.action(function (...args) {
|
|
151
157
|
this.envs = envs
|
|
@@ -159,8 +165,9 @@ program.command('rotate')
|
|
|
159
165
|
.option('-fk, --env-keys-file <path>', 'path to your .env.keys file (default: same path as your env file)')
|
|
160
166
|
.option('-k, --key <keys...>', 'keys(s) to encrypt (default: all keys in file)')
|
|
161
167
|
.option('-ek, --exclude-key <excludeKeys...>', 'keys(s) to exclude from encryption (default: none)')
|
|
162
|
-
.option('--no-
|
|
163
|
-
.
|
|
168
|
+
.option('--no-armor', 'disable dotenvx-armor features')
|
|
169
|
+
.addOption(new Option('--no-vlt', 'disable dotenvx-vlt features (deprecated. use --no-armor)').hideHelp())
|
|
170
|
+
.addOption(new Option('--no-ops', 'disable dotenvx-ops features (deprecated. use --no-armor)').hideHelp())
|
|
164
171
|
.option('--stdout', 'send to stdout')
|
|
165
172
|
.action(function (...args) {
|
|
166
173
|
this.envs = envs
|
|
@@ -174,8 +181,9 @@ program.command('keypair')
|
|
|
174
181
|
.argument('[KEY]', 'environment variable key name')
|
|
175
182
|
.option('-f, --env-file <paths...>', 'path(s) to your env file(s)')
|
|
176
183
|
.option('-fk, --env-keys-file <path>', 'path to your .env.keys file (default: same path as your env file)')
|
|
177
|
-
.option('--no-
|
|
178
|
-
.
|
|
184
|
+
.option('--no-armor', 'disable dotenvx-armor features')
|
|
185
|
+
.addOption(new Option('--no-vlt', 'disable dotenvx-vlt features (deprecated. use --no-armor)').hideHelp())
|
|
186
|
+
.addOption(new Option('--no-ops', 'disable dotenvx-ops features (deprecated. use --no-armor)').hideHelp())
|
|
179
187
|
.option('-pp, --pretty-print', 'pretty print output')
|
|
180
188
|
.option('--pp', 'pretty print output (alias)')
|
|
181
189
|
.option('--format <type>', 'format of the output (json, shell, colon)', 'json')
|
|
@@ -206,8 +214,8 @@ program.command('login', { hidden: true })
|
|
|
206
214
|
.description('')
|
|
207
215
|
.allowUnknownOption()
|
|
208
216
|
.action(() => {
|
|
209
|
-
const rawArgs = ['
|
|
210
|
-
executeDynamic(program, '
|
|
217
|
+
const rawArgs = ['armor', 'login', ...process.argv.slice(3)]
|
|
218
|
+
executeDynamic(program, 'armor', rawArgs)
|
|
211
219
|
})
|
|
212
220
|
|
|
213
221
|
// dotenvx logout
|
|
@@ -215,17 +223,8 @@ program.command('logout', { hidden: true })
|
|
|
215
223
|
.description('log out of your dotenvx account')
|
|
216
224
|
.allowUnknownOption()
|
|
217
225
|
.action(() => {
|
|
218
|
-
const rawArgs = ['
|
|
219
|
-
executeDynamic(program, '
|
|
220
|
-
})
|
|
221
|
-
|
|
222
|
-
// dotenvx armor
|
|
223
|
-
program.command('armor', { hidden: true })
|
|
224
|
-
.description('ARMORED KEYS ⛨')
|
|
225
|
-
.allowUnknownOption()
|
|
226
|
-
.action((args) => {
|
|
227
|
-
const rawArgs = ['vlt', 'armor', ...process.argv.slice(3)]
|
|
228
|
-
executeDynamic(program, 'vlt', rawArgs)
|
|
226
|
+
const rawArgs = ['armor', 'logout', ...process.argv.slice(3)]
|
|
227
|
+
executeDynamic(program, 'armor', rawArgs)
|
|
229
228
|
})
|
|
230
229
|
|
|
231
230
|
// dotenvx help
|
|
@@ -244,11 +243,10 @@ program.command('help [command]')
|
|
|
244
243
|
}
|
|
245
244
|
})
|
|
246
245
|
|
|
247
|
-
// dotenvx
|
|
246
|
+
// dotenvx armor
|
|
248
247
|
program.addHelpText('after', ' ')
|
|
249
248
|
program.addHelpText('after', 'Advanced: ')
|
|
250
|
-
program.addHelpText('after', '
|
|
251
|
-
program.addHelpText('after', ' vlt ⛨ ARMORED KEYS [www.dotenvx.com/vlt]')
|
|
249
|
+
program.addHelpText('after', ' armor ⛨ ARMORED KEYS [www.dotenvx.com/armor]')
|
|
252
250
|
program.addHelpText('after', ' ext ⊕ extensions')
|
|
253
251
|
|
|
254
252
|
// dotenvx ext
|
package/src/db/session.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Armor = require('./../lib/extensions/armor')
|
|
2
2
|
const { logger } = require('./../shared/logger')
|
|
3
3
|
|
|
4
4
|
class Session {
|
|
5
5
|
constructor () {
|
|
6
|
-
this.
|
|
6
|
+
this.armor = new Armor()
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
//
|
|
10
|
-
//
|
|
10
|
+
// armor status helpers
|
|
11
11
|
//
|
|
12
|
-
async
|
|
13
|
-
const status = await this.
|
|
14
|
-
logger.debug(`
|
|
12
|
+
async noArmor () {
|
|
13
|
+
const status = await this.armor.status()
|
|
14
|
+
logger.debug(`armor: ${status}`)
|
|
15
15
|
return status === 'off'
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
const status = this.
|
|
20
|
-
logger.debug(`
|
|
18
|
+
noArmorSync () {
|
|
19
|
+
const status = this.armor.statusSync()
|
|
20
|
+
logger.debug(`armor: ${status}`)
|
|
21
21
|
return status === 'off'
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -4,9 +4,9 @@ const util = require('util')
|
|
|
4
4
|
const { logger } = require('../../shared/logger')
|
|
5
5
|
|
|
6
6
|
const execFile = util.promisify(childProcess.execFile)
|
|
7
|
-
const BINARY_NAMES = ['dotenvx-vlt', 'dotenvx-ops']
|
|
7
|
+
const BINARY_NAMES = ['dotenvx-armor', 'dotenvx-vlt', 'dotenvx-ops']
|
|
8
8
|
|
|
9
|
-
class
|
|
9
|
+
class Armor {
|
|
10
10
|
async status () {
|
|
11
11
|
if (this._isForcedOff()) return 'off'
|
|
12
12
|
|
|
@@ -195,8 +195,8 @@ class Vlt {
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
_isForcedOff () {
|
|
198
|
-
return process.env.
|
|
198
|
+
return process.env.DOTENVX_NO_ARMOR === 'true' || process.env.DOTENVX_NO_VLT === 'true' || process.env.DOTENVX_NO_OPS === 'true'
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
module.exports =
|
|
202
|
+
module.exports = Armor
|