@dotenvx/dotenvx 1.69.2 → 1.70.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 +7 -1
- package/README.md +20 -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 +4 -4
- package/src/cli/actions/set.js +4 -4
- package/src/cli/commands/ext.js +1 -1
- package/src/cli/dotenvx.js +30 -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 +6 -6
- package/src/lib/helpers/keyResolution/keyValuesFromEnvSrc.js +5 -5
- package/src/lib/helpers/keyResolution/keyValuesSync.js +8 -8
- package/src/lib/main.d.ts +37 -13
- package/src/lib/main.js +11 -11
- 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 +8 -8
- 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,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.
|
|
5
|
+
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.70.0...main)
|
|
6
|
+
|
|
7
|
+
## [1.70.0](https://github.com/dotenvx/dotenvx/compare/v1.69.2...v1.70.0) (2026-05-31)
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
* Dotenvx Ops/Vlt is now Dotenvx Armor ⛨ ([#830](https://github.com/dotenvx/dotenvx/pull/830))
|
|
6
12
|
|
|
7
13
|
## [1.69.2](https://github.com/dotenvx/dotenvx/compare/v1.69.1...v1.69.2) (2026-05-29)
|
|
8
14
|
|
package/README.md
CHANGED
|
@@ -1287,14 +1287,16 @@ $ dotenvx run -fk .env.keys -f apps/app1/.env -- yourcommand
|
|
|
1287
1287
|
```
|
|
1288
1288
|
|
|
1289
1289
|
</details>
|
|
1290
|
-
<details><summary>`run --no-
|
|
1290
|
+
<details><summary>`run --no-armor`</summary><br>
|
|
1291
1291
|
|
|
1292
|
-
Turn off [Dotenvx
|
|
1292
|
+
Turn off [Dotenvx Armor ⛨](https://dotenvx.com/armor) features.
|
|
1293
1293
|
|
|
1294
1294
|
```sh
|
|
1295
|
-
$ dotenvx run --no-
|
|
1295
|
+
$ dotenvx run --no-armor -- yourcommand
|
|
1296
1296
|
```
|
|
1297
1297
|
|
|
1298
|
+
`--no-vlt` and `--no-ops` are deprecated aliases.
|
|
1299
|
+
|
|
1298
1300
|
</details>
|
|
1299
1301
|
<details><summary>`get KEY`</summary><br>
|
|
1300
1302
|
|
|
@@ -1622,15 +1624,17 @@ $ dotenvx encrypt -f .env.production
|
|
|
1622
1624
|
```
|
|
1623
1625
|
|
|
1624
1626
|
</details>
|
|
1625
|
-
<details><summary>`encrypt --no-
|
|
1627
|
+
<details><summary>`encrypt --no-armor`</summary><br>
|
|
1626
1628
|
|
|
1627
|
-
Turn off [Dotenvx
|
|
1629
|
+
Turn off [Dotenvx Armor ⛨](https://dotenvx.com/armor) features for encrypt.
|
|
1628
1630
|
|
|
1629
1631
|
```sh
|
|
1630
|
-
$ dotenvx encrypt --no-
|
|
1632
|
+
$ dotenvx encrypt --no-armor
|
|
1631
1633
|
◈ encrypted (.env)
|
|
1632
1634
|
```
|
|
1633
1635
|
|
|
1636
|
+
`--no-vlt` and `--no-ops` are deprecated aliases.
|
|
1637
|
+
|
|
1634
1638
|
</details>
|
|
1635
1639
|
<details><summary>`encrypt -fk`</summary><br>
|
|
1636
1640
|
|
|
@@ -2548,15 +2552,17 @@ $ dotenvx run --convention=nextjs -- node index.js
|
|
|
2548
2552
|
```
|
|
2549
2553
|
|
|
2550
2554
|
</details>
|
|
2551
|
-
<details><summary>`config(
|
|
2555
|
+
<details><summary>`config(noArmor:)` - noArmor</summary><br>
|
|
2552
2556
|
|
|
2553
|
-
Turn off [Dotenvx
|
|
2557
|
+
Turn off [Dotenvx Armor ⛨](https://dotenvx.com/armor) features.
|
|
2554
2558
|
|
|
2555
2559
|
```js
|
|
2556
2560
|
// index.js
|
|
2557
|
-
require('@dotenvx/dotenvx').config({
|
|
2561
|
+
require('@dotenvx/dotenvx').config({noArmor: true})
|
|
2558
2562
|
```
|
|
2559
2563
|
|
|
2564
|
+
`noVlt` and `noOps` are deprecated aliases.
|
|
2565
|
+
|
|
2560
2566
|
</details>
|
|
2561
2567
|
<details><summary>`parse(src)`</summary><br>
|
|
2562
2568
|
|
|
@@ -2650,17 +2656,17 @@ This is known as *Decryption at Access* and is written about in [the whitepaper]
|
|
|
2650
2656
|
|
|
2651
2657
|
|
|
2652
2658
|
|
|
2653
|
-
##
|
|
2659
|
+
## Armor ⛨
|
|
2654
2660
|
|
|
2655
|
-
[](https://dotenvx.com/armor)
|
|
2656
2662
|
|
|
2657
2663
|
```
|
|
2658
2664
|
⛨ ARMORED KEYS: Harden your private keys.
|
|
2659
|
-
⮕ install [curl -sfS https://dotenvx.sh/
|
|
2660
|
-
⮕ then run [dotenvx
|
|
2665
|
+
⮕ install [curl -sfS https://dotenvx.sh/armor | sh]
|
|
2666
|
+
⮕ then run [dotenvx armor login]
|
|
2661
2667
|
```
|
|
2662
2668
|
|
|
2663
|
-
[Learn more](https://dotenvx.com/
|
|
2669
|
+
[Learn more](https://dotenvx.com/armor)
|
|
2664
2670
|
|
|
2665
2671
|
|
|
2666
2672
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.70.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 || (await sesh.noArmor())
|
|
26
26
|
|
|
27
27
|
if (commandArgs.length < 1) {
|
|
28
28
|
if (spinner) spinner.stop()
|
|
@@ -54,7 +54,7 @@ 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
58
|
keypairHooks: {
|
|
59
59
|
after: () => {
|
|
60
60
|
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,9 @@ 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('--no-
|
|
74
|
-
.
|
|
73
|
+
.option('--no-armor', 'disable dotenvx-armor features')
|
|
74
|
+
.addOption(new Option('--no-vlt', 'disable dotenvx-vlt features (deprecated. use --no-armor)').hideHelp())
|
|
75
|
+
.addOption(new Option('--no-ops', 'disable dotenvx-ops features (deprecated. use --no-armor)').hideHelp())
|
|
75
76
|
.action(function (...args) {
|
|
76
77
|
this.envs = envs
|
|
77
78
|
return require('./actions/run').apply(this, args)
|
|
@@ -93,8 +94,9 @@ program.command('get')
|
|
|
93
94
|
.option('-pp, --pretty-print', 'pretty print output')
|
|
94
95
|
.option('--pp', 'pretty print output (alias)')
|
|
95
96
|
.option('--format <type>', 'format of the output (json, shell, colon, eval)', 'json')
|
|
96
|
-
.option('--no-
|
|
97
|
-
.
|
|
97
|
+
.option('--no-armor', 'disable dotenvx-armor features')
|
|
98
|
+
.addOption(new Option('--no-vlt', 'disable dotenvx-vlt features (deprecated. use --no-armor)').hideHelp())
|
|
99
|
+
.addOption(new Option('--no-ops', 'disable dotenvx-ops features (deprecated. use --no-armor)').hideHelp())
|
|
98
100
|
.action(function (...args) {
|
|
99
101
|
this.envs = envs
|
|
100
102
|
return require('./actions/get').apply(this, args)
|
|
@@ -113,8 +115,9 @@ program.command('set')
|
|
|
113
115
|
.option('-c, --encrypt', 'encrypt value', true)
|
|
114
116
|
.option('-p, --plain', 'store value as plain text', false)
|
|
115
117
|
.option('--no-create', 'do not create .env file(s) when missing')
|
|
116
|
-
.option('--no-
|
|
117
|
-
.
|
|
118
|
+
.option('--no-armor', 'disable dotenvx-armor features')
|
|
119
|
+
.addOption(new Option('--no-vlt', 'disable dotenvx-vlt features (deprecated. use --no-armor)').hideHelp())
|
|
120
|
+
.addOption(new Option('--no-ops', 'disable dotenvx-ops features (deprecated. use --no-armor)').hideHelp())
|
|
118
121
|
.action(function (...args) {
|
|
119
122
|
this.envs = envs
|
|
120
123
|
return require('./actions/set').apply(this, args)
|
|
@@ -128,10 +131,11 @@ program.command('encrypt')
|
|
|
128
131
|
.option('-k, --key <keys...>', 'keys(s) to encrypt (default: all keys in file)')
|
|
129
132
|
.option('-ek, --exclude-key <excludeKeys...>', 'keys(s) to exclude from encryption (default: none)')
|
|
130
133
|
.option('--stdout', 'send to stdout')
|
|
131
|
-
.option('--token <token>', 'set
|
|
134
|
+
.option('--token <token>', 'set Armor ⛨ token')
|
|
132
135
|
.option('--no-create', 'do not create .env file(s) when missing')
|
|
133
|
-
.option('--no-
|
|
134
|
-
.
|
|
136
|
+
.option('--no-armor', 'disable dotenvx-armor features')
|
|
137
|
+
.addOption(new Option('--no-vlt', 'disable dotenvx-vlt features (deprecated. use --no-armor)').hideHelp())
|
|
138
|
+
.addOption(new Option('--no-ops', 'disable dotenvx-ops features (deprecated. use --no-armor)').hideHelp())
|
|
135
139
|
.action(function (...args) {
|
|
136
140
|
this.envs = envs
|
|
137
141
|
return require('./actions/encrypt').apply(this, args)
|
|
@@ -144,8 +148,9 @@ program.command('decrypt')
|
|
|
144
148
|
.option('-fk, --env-keys-file <path>', 'path to your .env.keys file (default: same path as your env file)')
|
|
145
149
|
.option('-k, --key <keys...>', 'keys(s) to decrypt (default: all keys in file)')
|
|
146
150
|
.option('-ek, --exclude-key <excludeKeys...>', 'keys(s) to exclude from decryption (default: none)')
|
|
147
|
-
.option('--no-
|
|
148
|
-
.
|
|
151
|
+
.option('--no-armor', 'disable dotenvx-armor features')
|
|
152
|
+
.addOption(new Option('--no-vlt', 'disable dotenvx-vlt features (deprecated. use --no-armor)').hideHelp())
|
|
153
|
+
.addOption(new Option('--no-ops', 'disable dotenvx-ops features (deprecated. use --no-armor)').hideHelp())
|
|
149
154
|
.option('--stdout', 'send to stdout')
|
|
150
155
|
.action(function (...args) {
|
|
151
156
|
this.envs = envs
|
|
@@ -159,8 +164,9 @@ program.command('rotate')
|
|
|
159
164
|
.option('-fk, --env-keys-file <path>', 'path to your .env.keys file (default: same path as your env file)')
|
|
160
165
|
.option('-k, --key <keys...>', 'keys(s) to encrypt (default: all keys in file)')
|
|
161
166
|
.option('-ek, --exclude-key <excludeKeys...>', 'keys(s) to exclude from encryption (default: none)')
|
|
162
|
-
.option('--no-
|
|
163
|
-
.
|
|
167
|
+
.option('--no-armor', 'disable dotenvx-armor features')
|
|
168
|
+
.addOption(new Option('--no-vlt', 'disable dotenvx-vlt features (deprecated. use --no-armor)').hideHelp())
|
|
169
|
+
.addOption(new Option('--no-ops', 'disable dotenvx-ops features (deprecated. use --no-armor)').hideHelp())
|
|
164
170
|
.option('--stdout', 'send to stdout')
|
|
165
171
|
.action(function (...args) {
|
|
166
172
|
this.envs = envs
|
|
@@ -174,8 +180,9 @@ program.command('keypair')
|
|
|
174
180
|
.argument('[KEY]', 'environment variable key name')
|
|
175
181
|
.option('-f, --env-file <paths...>', 'path(s) to your env file(s)')
|
|
176
182
|
.option('-fk, --env-keys-file <path>', 'path to your .env.keys file (default: same path as your env file)')
|
|
177
|
-
.option('--no-
|
|
178
|
-
.
|
|
183
|
+
.option('--no-armor', 'disable dotenvx-armor features')
|
|
184
|
+
.addOption(new Option('--no-vlt', 'disable dotenvx-vlt features (deprecated. use --no-armor)').hideHelp())
|
|
185
|
+
.addOption(new Option('--no-ops', 'disable dotenvx-ops features (deprecated. use --no-armor)').hideHelp())
|
|
179
186
|
.option('-pp, --pretty-print', 'pretty print output')
|
|
180
187
|
.option('--pp', 'pretty print output (alias)')
|
|
181
188
|
.option('--format <type>', 'format of the output (json, shell, colon)', 'json')
|
|
@@ -206,8 +213,8 @@ program.command('login', { hidden: true })
|
|
|
206
213
|
.description('')
|
|
207
214
|
.allowUnknownOption()
|
|
208
215
|
.action(() => {
|
|
209
|
-
const rawArgs = ['
|
|
210
|
-
executeDynamic(program, '
|
|
216
|
+
const rawArgs = ['armor', 'login', ...process.argv.slice(3)]
|
|
217
|
+
executeDynamic(program, 'armor', rawArgs)
|
|
211
218
|
})
|
|
212
219
|
|
|
213
220
|
// dotenvx logout
|
|
@@ -215,17 +222,8 @@ program.command('logout', { hidden: true })
|
|
|
215
222
|
.description('log out of your dotenvx account')
|
|
216
223
|
.allowUnknownOption()
|
|
217
224
|
.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)
|
|
225
|
+
const rawArgs = ['armor', 'logout', ...process.argv.slice(3)]
|
|
226
|
+
executeDynamic(program, 'armor', rawArgs)
|
|
229
227
|
})
|
|
230
228
|
|
|
231
229
|
// dotenvx help
|
|
@@ -244,11 +242,10 @@ program.command('help [command]')
|
|
|
244
242
|
}
|
|
245
243
|
})
|
|
246
244
|
|
|
247
|
-
// dotenvx
|
|
245
|
+
// dotenvx armor
|
|
248
246
|
program.addHelpText('after', ' ')
|
|
249
247
|
program.addHelpText('after', 'Advanced: ')
|
|
250
|
-
program.addHelpText('after', '
|
|
251
|
-
program.addHelpText('after', ' vlt ⛨ ARMORED KEYS [www.dotenvx.com/vlt]')
|
|
248
|
+
program.addHelpText('after', ' armor ⛨ ARMORED KEYS [www.dotenvx.com/armor]')
|
|
252
249
|
program.addHelpText('after', ' ext ⊕ extensions')
|
|
253
250
|
|
|
254
251
|
// 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
|