@dotenvx/dotenvx 1.68.1 → 1.69.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 +14 -2
- package/README.md +14 -14
- package/package.json +3 -3
- package/src/cli/actions/decrypt.js +5 -4
- package/src/cli/actions/encrypt.js +12 -11
- package/src/cli/actions/get.js +4 -3
- package/src/cli/actions/keypair.js +4 -3
- package/src/cli/actions/normalizeVltOptions.js +10 -0
- package/src/cli/actions/rotate.js +5 -4
- package/src/cli/actions/run.js +4 -3
- package/src/cli/actions/set.js +4 -3
- package/src/cli/dotenvx.js +12 -6
- package/src/db/session.js +9 -9
- package/src/lib/extensions/{ops.js → vlt.js} +25 -28
- 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/cryptography/{opsKeypair.js → vltKeypair.js} +4 -4
- package/src/lib/helpers/cryptography/vltKeypairSync.js +14 -0
- package/src/lib/helpers/executeDynamic.js +16 -13
- package/src/lib/helpers/keyResolution/keyValues.js +5 -5
- package/src/lib/helpers/keyResolution/keyValuesFromEnvSrc.js +4 -4
- package/src/lib/helpers/keyResolution/keyValuesSync.js +7 -7
- package/src/lib/main.d.ts +21 -9
- package/src/lib/main.js +11 -11
- package/src/lib/services/decrypt.js +3 -3
- 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 +5 -5
- package/src/lib/services/sets.js +6 -6
- package/src/lib/helpers/cryptography/opsKeypairSync.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.69.1...main)
|
|
6
|
+
|
|
7
|
+
## [1.69.1](https://github.com/dotenvx/dotenvx/compare/v1.69.0...v1.69.1) (2026-05-25)
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
* Internally rename `ops` to `vlt` ([#823](https://github.com/dotenvx/dotenvx/pull/823))
|
|
12
|
+
|
|
13
|
+
## [1.69.0](https://github.com/dotenvx/dotenvx/compare/v1.68.1...v1.69.0) (2026-05-25)
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
* Remove fully-deprecated `opsOff` option in favor of `noOps` ([#822](https://github.com/dotenvx/dotenvx/pull/822))
|
|
6
18
|
|
|
7
19
|
## [1.68.1](https://github.com/dotenvx/dotenvx/compare/v1.68.0...v1.68.1) (2026-05-24)
|
|
8
20
|
|
|
@@ -296,7 +308,7 @@ export default {
|
|
|
296
308
|
|
|
297
309
|
### Added
|
|
298
310
|
|
|
299
|
-
* Add hint on `.env.keys` for `dotenvx
|
|
311
|
+
* Add hint on `.env.keys` for `dotenvx armor up`. Dotenvx Armor lets you armor your private keys securely with just a single command. It's a convenient alternative to manually copy/pasting them in and out of 1Password. ([#718](https://github.com/dotenvx/dotenvx/pull/718))
|
|
300
312
|
|
|
301
313
|
## [1.51.2](https://github.com/dotenvx/dotenvx/compare/v1.51.1...v1.51.2) (2025-12-12)
|
|
302
314
|
|
package/README.md
CHANGED
|
@@ -1287,12 +1287,12 @@ $ 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-vlt`</summary><br>
|
|
1291
1291
|
|
|
1292
|
-
Turn off [Dotenvx Ops](https://dotenvx.com/
|
|
1292
|
+
Turn off [Dotenvx Vlt Ops](https://dotenvx.com/vlt) features.
|
|
1293
1293
|
|
|
1294
1294
|
```sh
|
|
1295
|
-
$ dotenvx run --no-
|
|
1295
|
+
$ dotenvx run --no-vlt -- yourcommand
|
|
1296
1296
|
```
|
|
1297
1297
|
|
|
1298
1298
|
</details>
|
|
@@ -1622,12 +1622,12 @@ $ dotenvx encrypt -f .env.production
|
|
|
1622
1622
|
```
|
|
1623
1623
|
|
|
1624
1624
|
</details>
|
|
1625
|
-
<details><summary>`encrypt --no-
|
|
1625
|
+
<details><summary>`encrypt --no-vlt`</summary><br>
|
|
1626
1626
|
|
|
1627
|
-
Turn off [Dotenvx Ops](https://dotenvx.com/
|
|
1627
|
+
Turn off [Dotenvx Vlt Ops](https://dotenvx.com/vlt) features for encrypt.
|
|
1628
1628
|
|
|
1629
1629
|
```sh
|
|
1630
|
-
$ dotenvx encrypt --no-
|
|
1630
|
+
$ dotenvx encrypt --no-vlt
|
|
1631
1631
|
◈ encrypted (.env)
|
|
1632
1632
|
```
|
|
1633
1633
|
|
|
@@ -2548,13 +2548,13 @@ $ dotenvx run --convention=nextjs -- node index.js
|
|
|
2548
2548
|
```
|
|
2549
2549
|
|
|
2550
2550
|
</details>
|
|
2551
|
-
<details><summary>`config(
|
|
2551
|
+
<details><summary>`config(noVlt:)` - noVlt</summary><br>
|
|
2552
2552
|
|
|
2553
|
-
Turn off [Dotenvx Ops](https://dotenvx.com/
|
|
2553
|
+
Turn off [Dotenvx Vlt Ops](https://dotenvx.com/vlt) features.
|
|
2554
2554
|
|
|
2555
2555
|
```js
|
|
2556
2556
|
// index.js
|
|
2557
|
-
require('@dotenvx/dotenvx').config({
|
|
2557
|
+
require('@dotenvx/dotenvx').config({noVlt: true})
|
|
2558
2558
|
```
|
|
2559
2559
|
|
|
2560
2560
|
</details>
|
|
@@ -2650,17 +2650,17 @@ This is known as *Decryption at Access* and is written about in [the whitepaper]
|
|
|
2650
2650
|
|
|
2651
2651
|
|
|
2652
2652
|
|
|
2653
|
-
## Ops ⛨
|
|
2653
|
+
## Vlt Ops ⛨
|
|
2654
2654
|
|
|
2655
|
-
[](https://dotenvx.com/vlt)
|
|
2656
2656
|
|
|
2657
2657
|
```
|
|
2658
2658
|
⛨ ARMORED KEYS: Harden your private keys.
|
|
2659
|
-
⮕ install [curl -sfS https://dotenvx.sh/
|
|
2660
|
-
⮕ then run [dotenvx-
|
|
2659
|
+
⮕ install [curl -sfS https://dotenvx.sh/vlt | sh]
|
|
2660
|
+
⮕ then run [dotenvx-vlt login]
|
|
2661
2661
|
```
|
|
2662
2662
|
|
|
2663
|
-
[Learn more](https://dotenvx.com/
|
|
2663
|
+
[Learn more](https://dotenvx.com/vlt)
|
|
2664
2664
|
|
|
2665
2665
|
|
|
2666
2666
|
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.69.1",
|
|
3
3
|
"name": "@dotenvx/dotenvx",
|
|
4
4
|
"description": "secrets for agents–from the creator of `dotenv`",
|
|
5
5
|
"author": "@motdotla",
|
|
@@ -35,8 +35,8 @@
|
|
|
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_VLT=true --allow-empty-coverage --disable-coverage --timeout=60000",
|
|
39
|
+
"test-coverage": "tap run --test-env=DOTENVX_NO_VLT=true --show-full-coverage --timeout=60000",
|
|
40
40
|
"testshell": "bash shellspec",
|
|
41
41
|
"prerelease": "npm test && npm run testshell",
|
|
42
42
|
"release": "standard-version"
|
|
@@ -5,16 +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 normalizeVltOptions = require('./normalizeVltOptions')
|
|
8
9
|
|
|
9
10
|
async function decrypt () {
|
|
10
|
-
const options = this.opts()
|
|
11
|
+
const options = normalizeVltOptions(this.opts())
|
|
11
12
|
const spinner = await createSpinner({ ...options, text: 'decrypting' })
|
|
12
13
|
|
|
13
14
|
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
14
15
|
|
|
15
16
|
const sesh = new Session()
|
|
16
17
|
const envs = this.envs
|
|
17
|
-
const
|
|
18
|
+
const noVlt = options.vlt === false || (await sesh.noVlt())
|
|
18
19
|
|
|
19
20
|
let errorCount = 0
|
|
20
21
|
|
|
@@ -22,7 +23,7 @@ async function decrypt () {
|
|
|
22
23
|
if (options.stdout) {
|
|
23
24
|
const {
|
|
24
25
|
processedEnvs
|
|
25
|
-
} = await new Decrypt(envs, options.key, options.excludeKey, options.envKeysFile,
|
|
26
|
+
} = await new Decrypt(envs, options.key, options.excludeKey, options.envKeysFile, noVlt).run()
|
|
26
27
|
if (spinner) spinner.stop()
|
|
27
28
|
for (const processedEnv of processedEnvs) {
|
|
28
29
|
if (processedEnv.error) {
|
|
@@ -44,7 +45,7 @@ async function decrypt () {
|
|
|
44
45
|
processedEnvs,
|
|
45
46
|
changedFilepaths,
|
|
46
47
|
unchangedFilepaths
|
|
47
|
-
} = await new Decrypt(envs, options.key, options.excludeKey, options.envKeysFile,
|
|
48
|
+
} = await new Decrypt(envs, options.key, options.excludeKey, options.envKeysFile, noVlt).run()
|
|
48
49
|
|
|
49
50
|
for (const processedEnv of processedEnvs) {
|
|
50
51
|
logger.verbose(`decrypting ${processedEnv.envFilepath} (${processedEnv.filepath})`)
|
|
@@ -8,21 +8,22 @@ const localDisplayPath = require('../../lib/helpers/localDisplayPath')
|
|
|
8
8
|
const createSpinner = require('../../lib/helpers/createSpinner')
|
|
9
9
|
const prompts = require('../../lib/helpers/prompts')
|
|
10
10
|
const Session = require('../../db/session')
|
|
11
|
+
const normalizeVltOptions = require('./normalizeVltOptions')
|
|
11
12
|
|
|
12
13
|
function keypairSpinnerHooks (spinner) {
|
|
13
|
-
let
|
|
14
|
+
let stoppedForVlt = false
|
|
14
15
|
|
|
15
16
|
return {
|
|
16
17
|
onStderr: () => {
|
|
17
|
-
if (spinner && !
|
|
18
|
+
if (spinner && !stoppedForVlt) {
|
|
18
19
|
spinner.stop()
|
|
19
|
-
|
|
20
|
+
stoppedForVlt = true
|
|
20
21
|
}
|
|
21
22
|
},
|
|
22
23
|
after: () => {
|
|
23
|
-
if (spinner &&
|
|
24
|
+
if (spinner && stoppedForVlt) {
|
|
24
25
|
spinner.start('encrypting')
|
|
25
|
-
|
|
26
|
+
stoppedForVlt = false
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
}
|
|
@@ -51,12 +52,12 @@ function keyStorageSelector (spinner) {
|
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
function encryptOptions (spinner,
|
|
55
|
+
function encryptOptions (spinner, noVlt) {
|
|
55
56
|
const options = {
|
|
56
57
|
keypairHooks: keypairSpinnerHooks(spinner)
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
if (!
|
|
60
|
+
if (!noVlt) {
|
|
60
61
|
options.selectKeyStorage = keyStorageSelector(spinner)
|
|
61
62
|
}
|
|
62
63
|
|
|
@@ -64,21 +65,21 @@ function encryptOptions (spinner, noOps) {
|
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
async function encrypt () {
|
|
67
|
-
const options = this.opts()
|
|
68
|
+
const options = normalizeVltOptions(this.opts())
|
|
68
69
|
const spinner = await createSpinner({ ...options, text: 'encrypting' })
|
|
69
70
|
|
|
70
71
|
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
71
72
|
|
|
72
73
|
const sesh = new Session()
|
|
73
74
|
const envs = this.envs
|
|
74
|
-
const
|
|
75
|
+
const noVlt = options.vlt === false || (!options.token && (await sesh.noVlt()))
|
|
75
76
|
const noCreate = options.create === false
|
|
76
77
|
|
|
77
78
|
// stdout - should not have a try so that exit codes can surface to stdout
|
|
78
79
|
if (options.stdout) {
|
|
79
80
|
const {
|
|
80
81
|
processedEnvs
|
|
81
|
-
} = await new Encrypt(envs, options.key, options.excludeKey, options.envKeysFile,
|
|
82
|
+
} = await new Encrypt(envs, options.key, options.excludeKey, options.envKeysFile, noVlt, noCreate, options.token, encryptOptions(spinner, noVlt)).run()
|
|
82
83
|
if (spinner) spinner.stop()
|
|
83
84
|
for (const processedEnv of processedEnvs) {
|
|
84
85
|
console.log(processedEnv.envSrc)
|
|
@@ -90,7 +91,7 @@ async function encrypt () {
|
|
|
90
91
|
processedEnvs,
|
|
91
92
|
changedFilepaths,
|
|
92
93
|
unchangedFilepaths
|
|
93
|
-
} = await new Encrypt(envs, options.key, options.excludeKey, options.envKeysFile,
|
|
94
|
+
} = await new Encrypt(envs, options.key, options.excludeKey, options.envKeysFile, noVlt, noCreate, options.token, encryptOptions(spinner, noVlt)).run()
|
|
94
95
|
|
|
95
96
|
for (const processedEnv of processedEnvs) {
|
|
96
97
|
logger.verbose(`encrypting ${processedEnv.envFilepath} (${processedEnv.filepath})`)
|
package/src/cli/actions/get.js
CHANGED
|
@@ -6,9 +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 normalizeVltOptions = require('./normalizeVltOptions')
|
|
9
10
|
|
|
10
11
|
async function get (key) {
|
|
11
|
-
const options = this.opts()
|
|
12
|
+
const options = normalizeVltOptions(this.opts())
|
|
12
13
|
const spinner = await createSpinner({ ...options, text: 'decrypting' })
|
|
13
14
|
|
|
14
15
|
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
@@ -29,8 +30,8 @@ async function get (key) {
|
|
|
29
30
|
|
|
30
31
|
try {
|
|
31
32
|
const sesh = new Session()
|
|
32
|
-
const
|
|
33
|
-
const { parsed, errors } = await new Get(key, envs, options.overload, options.all, options.envKeysFile,
|
|
33
|
+
const noVlt = options.vlt === false || (await sesh.noVlt())
|
|
34
|
+
const { parsed, errors } = await new Get(key, envs, options.overload, options.all, options.envKeysFile, noVlt).run()
|
|
34
35
|
|
|
35
36
|
for (const error of errors || []) {
|
|
36
37
|
if (options.strict) throw error // throw immediately if strict
|
|
@@ -3,9 +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 normalizeVltOptions = require('./normalizeVltOptions')
|
|
6
7
|
|
|
7
8
|
async function keypair (key) {
|
|
8
|
-
const options = this.opts()
|
|
9
|
+
const options = normalizeVltOptions(this.opts())
|
|
9
10
|
const spinner = await createSpinner({ ...options, text: 'retrieving' })
|
|
10
11
|
|
|
11
12
|
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
@@ -16,8 +17,8 @@ async function keypair (key) {
|
|
|
16
17
|
const prettyPrint = options.prettyPrint || options.pp
|
|
17
18
|
|
|
18
19
|
const sesh = new Session()
|
|
19
|
-
const
|
|
20
|
-
const keypairs = await new Keypair(options.envFile, options.envKeysFile,
|
|
20
|
+
const noVlt = options.vlt === false || await sesh.noVlt()
|
|
21
|
+
const keypairs = await new Keypair(options.envFile, options.envKeysFile, noVlt).run()
|
|
21
22
|
const results = key ? keypairs[key] : keypairs
|
|
22
23
|
|
|
23
24
|
if (spinner) spinner.stop()
|
|
@@ -7,22 +7,23 @@ const catchAndLog = require('../../lib/helpers/catchAndLog')
|
|
|
7
7
|
const createSpinner = require('../../lib/helpers/createSpinner')
|
|
8
8
|
const localDisplayPath = require('../../lib/helpers/localDisplayPath')
|
|
9
9
|
const Session = require('../../db/session')
|
|
10
|
+
const normalizeVltOptions = require('./normalizeVltOptions')
|
|
10
11
|
|
|
11
12
|
async function rotate () {
|
|
12
|
-
const options = this.opts()
|
|
13
|
+
const options = normalizeVltOptions(this.opts())
|
|
13
14
|
const spinner = await createSpinner({ ...options, text: 'rotating', frames: ['⟳', '⤾', '⥁'] })
|
|
14
15
|
|
|
15
16
|
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
16
17
|
|
|
17
18
|
const envs = this.envs
|
|
18
19
|
const sesh = new Session()
|
|
19
|
-
const
|
|
20
|
+
const noVlt = options.vlt === false || (await sesh.noVlt())
|
|
20
21
|
|
|
21
22
|
// stdout - should not have a try so that exit codes can surface to stdout
|
|
22
23
|
if (options.stdout) {
|
|
23
24
|
const {
|
|
24
25
|
processedEnvs
|
|
25
|
-
} = await new Rotate(envs, options.key, options.excludeKey, options.envKeysFile,
|
|
26
|
+
} = await new Rotate(envs, options.key, options.excludeKey, options.envKeysFile, noVlt).run()
|
|
26
27
|
if (spinner) spinner.stop()
|
|
27
28
|
for (const processedEnv of processedEnvs) {
|
|
28
29
|
console.log(processedEnv.envSrc)
|
|
@@ -38,7 +39,7 @@ async function rotate () {
|
|
|
38
39
|
processedEnvs,
|
|
39
40
|
changedFilepaths,
|
|
40
41
|
unchangedFilepaths
|
|
41
|
-
} = await new Rotate(envs, options.key, options.excludeKey, options.envKeysFile,
|
|
42
|
+
} = await new Rotate(envs, options.key, options.excludeKey, options.envKeysFile, noVlt).run()
|
|
42
43
|
|
|
43
44
|
for (const processedEnv of processedEnvs) {
|
|
44
45
|
logger.verbose(`rotating ${processedEnv.envFilepath} (${processedEnv.filepath})`)
|
package/src/cli/actions/run.js
CHANGED
|
@@ -6,12 +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 normalizeVltOptions = require('./normalizeVltOptions')
|
|
9
10
|
|
|
10
11
|
const conventions = require('./../../lib/helpers/conventions')
|
|
11
12
|
const { determine } = require('./../../lib/helpers/envResolution')
|
|
12
13
|
|
|
13
14
|
async function run () {
|
|
14
|
-
const options = this.opts()
|
|
15
|
+
const options = normalizeVltOptions(this.opts())
|
|
15
16
|
const commandArgs = this.args
|
|
16
17
|
const spinner = await createSpinner({ ...options, text: 'injecting' })
|
|
17
18
|
|
|
@@ -21,7 +22,7 @@ async function run () {
|
|
|
21
22
|
const ignore = options.ignore || []
|
|
22
23
|
|
|
23
24
|
const sesh = new Session()
|
|
24
|
-
const
|
|
25
|
+
const noVlt = options.vlt === false || (await sesh.noVlt())
|
|
25
26
|
|
|
26
27
|
if (commandArgs.length < 1) {
|
|
27
28
|
if (spinner) spinner.stop()
|
|
@@ -53,7 +54,7 @@ async function run () {
|
|
|
53
54
|
readableStrings,
|
|
54
55
|
readableFilepaths,
|
|
55
56
|
uniqueInjectedKeys
|
|
56
|
-
} = await new Run(envs, options.overload, process.env, options.envKeysFile,
|
|
57
|
+
} = await new Run(envs, options.overload, process.env, options.envKeysFile, noVlt, {
|
|
57
58
|
keypairHooks: {
|
|
58
59
|
before: () => {
|
|
59
60
|
if (spinner) spinner.start('retrieving')
|
package/src/cli/actions/set.js
CHANGED
|
@@ -6,9 +6,10 @@ const createSpinner = require('../../lib/helpers/createSpinner')
|
|
|
6
6
|
const localDisplayPath = require('../../lib/helpers/localDisplayPath')
|
|
7
7
|
const Session = require('../../db/session')
|
|
8
8
|
const Sets = require('./../../lib/services/sets')
|
|
9
|
+
const normalizeVltOptions = require('./normalizeVltOptions')
|
|
9
10
|
|
|
10
11
|
async function set (key, value) {
|
|
11
|
-
const options = this.opts()
|
|
12
|
+
const options = normalizeVltOptions(this.opts())
|
|
12
13
|
|
|
13
14
|
let encrypt = true
|
|
14
15
|
let settingMessage = 'encrypting'
|
|
@@ -27,14 +28,14 @@ async function set (key, value) {
|
|
|
27
28
|
const sesh = new Session()
|
|
28
29
|
const envs = this.envs
|
|
29
30
|
const envKeysFilepath = options.envKeysFile
|
|
30
|
-
const
|
|
31
|
+
const noVlt = options.vlt === false || (await sesh.noVlt())
|
|
31
32
|
const noCreate = options.create === false
|
|
32
33
|
|
|
33
34
|
const {
|
|
34
35
|
processedEnvs,
|
|
35
36
|
changedFilepaths,
|
|
36
37
|
unchangedFilepaths
|
|
37
|
-
} = await new Sets(key, value, envs, encrypt, envKeysFilepath,
|
|
38
|
+
} = await new Sets(key, value, envs, encrypt, envKeysFilepath, noVlt, noCreate).run()
|
|
38
39
|
|
|
39
40
|
let withEncryption = ''
|
|
40
41
|
|
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
|
|
4
|
+
const { Command } = 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-vlt, etc
|
|
47
47
|
program
|
|
48
48
|
.argument('[command]', 'dynamic command')
|
|
49
49
|
.argument('[args...]', 'dynamic command arguments')
|
|
@@ -71,7 +71,7 @@ program.command('run')
|
|
|
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
73
|
.option('--no-ops', 'disable dotenvx-ops features')
|
|
74
|
-
.
|
|
74
|
+
.option('--no-vlt', 'disable dotenvx-vlt features')
|
|
75
75
|
.action(function (...args) {
|
|
76
76
|
this.envs = envs
|
|
77
77
|
return require('./actions/run').apply(this, args)
|
|
@@ -94,6 +94,7 @@ program.command('get')
|
|
|
94
94
|
.option('--pp', 'pretty print output (alias)')
|
|
95
95
|
.option('--format <type>', 'format of the output (json, shell, colon, eval)', 'json')
|
|
96
96
|
.option('--no-ops', 'disable dotenvx-ops features')
|
|
97
|
+
.option('--no-vlt', 'disable dotenvx-vlt features')
|
|
97
98
|
.action(function (...args) {
|
|
98
99
|
this.envs = envs
|
|
99
100
|
return require('./actions/get').apply(this, args)
|
|
@@ -113,6 +114,7 @@ program.command('set')
|
|
|
113
114
|
.option('-p, --plain', 'store value as plain text', false)
|
|
114
115
|
.option('--no-create', 'do not create .env file(s) when missing')
|
|
115
116
|
.option('--no-ops', 'disable dotenvx-ops features')
|
|
117
|
+
.option('--no-vlt', 'disable dotenvx-vlt features')
|
|
116
118
|
.action(function (...args) {
|
|
117
119
|
this.envs = envs
|
|
118
120
|
return require('./actions/set').apply(this, args)
|
|
@@ -126,9 +128,10 @@ program.command('encrypt')
|
|
|
126
128
|
.option('-k, --key <keys...>', 'keys(s) to encrypt (default: all keys in file)')
|
|
127
129
|
.option('-ek, --exclude-key <excludeKeys...>', 'keys(s) to exclude from encryption (default: none)')
|
|
128
130
|
.option('--stdout', 'send to stdout')
|
|
129
|
-
.option('--token <token>', 'set Ops token')
|
|
131
|
+
.option('--token <token>', 'set Vlt Ops token')
|
|
130
132
|
.option('--no-create', 'do not create .env file(s) when missing')
|
|
131
133
|
.option('--no-ops', 'disable dotenvx-ops features')
|
|
134
|
+
.option('--no-vlt', 'disable dotenvx-vlt features')
|
|
132
135
|
.action(function (...args) {
|
|
133
136
|
this.envs = envs
|
|
134
137
|
return require('./actions/encrypt').apply(this, args)
|
|
@@ -142,6 +145,7 @@ program.command('decrypt')
|
|
|
142
145
|
.option('-k, --key <keys...>', 'keys(s) to decrypt (default: all keys in file)')
|
|
143
146
|
.option('-ek, --exclude-key <excludeKeys...>', 'keys(s) to exclude from decryption (default: none)')
|
|
144
147
|
.option('--no-ops', 'disable dotenvx-ops features')
|
|
148
|
+
.option('--no-vlt', 'disable dotenvx-vlt features')
|
|
145
149
|
.option('--stdout', 'send to stdout')
|
|
146
150
|
.action(function (...args) {
|
|
147
151
|
this.envs = envs
|
|
@@ -156,6 +160,7 @@ program.command('rotate')
|
|
|
156
160
|
.option('-k, --key <keys...>', 'keys(s) to encrypt (default: all keys in file)')
|
|
157
161
|
.option('-ek, --exclude-key <excludeKeys...>', 'keys(s) to exclude from encryption (default: none)')
|
|
158
162
|
.option('--no-ops', 'disable dotenvx-ops features')
|
|
163
|
+
.option('--no-vlt', 'disable dotenvx-vlt features')
|
|
159
164
|
.option('--stdout', 'send to stdout')
|
|
160
165
|
.action(function (...args) {
|
|
161
166
|
this.envs = envs
|
|
@@ -170,6 +175,7 @@ program.command('keypair')
|
|
|
170
175
|
.option('-f, --env-file <paths...>', 'path(s) to your env file(s)')
|
|
171
176
|
.option('-fk, --env-keys-file <path>', 'path to your .env.keys file (default: same path as your env file)')
|
|
172
177
|
.option('--no-ops', 'disable dotenvx-ops features')
|
|
178
|
+
.option('--no-vlt', 'disable dotenvx-vlt features')
|
|
173
179
|
.option('-pp, --pretty-print', 'pretty print output')
|
|
174
180
|
.option('--pp', 'pretty print output (alias)')
|
|
175
181
|
.option('--format <type>', 'format of the output (json, shell, colon)', 'json')
|
|
@@ -238,10 +244,10 @@ program.command('help [command]')
|
|
|
238
244
|
}
|
|
239
245
|
})
|
|
240
246
|
|
|
241
|
-
// dotenvx ops
|
|
247
|
+
// dotenvx vlt ops
|
|
242
248
|
program.addHelpText('after', ' ')
|
|
243
249
|
program.addHelpText('after', 'Advanced: ')
|
|
244
|
-
program.addHelpText('after', '
|
|
250
|
+
program.addHelpText('after', ' vlt ⛨ Vlt Ops [www.dotenvx.com/vlt]')
|
|
245
251
|
program.addHelpText('after', ' ext 🔌 extensions')
|
|
246
252
|
|
|
247
253
|
// dotenvx ext
|
package/src/db/session.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Vlt = require('./../lib/extensions/vlt')
|
|
2
2
|
const { logger } = require('./../shared/logger')
|
|
3
3
|
|
|
4
4
|
class Session {
|
|
5
5
|
constructor () {
|
|
6
|
-
this.
|
|
6
|
+
this.vlt = new Vlt()
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
//
|
|
10
|
-
//
|
|
10
|
+
// vlt status helpers
|
|
11
11
|
//
|
|
12
|
-
async
|
|
13
|
-
const status = await this.
|
|
14
|
-
logger.debug(`
|
|
12
|
+
async noVlt () {
|
|
13
|
+
const status = await this.vlt.status()
|
|
14
|
+
logger.debug(`vlt: ${status}`)
|
|
15
15
|
return status === 'off'
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
const status = this.
|
|
20
|
-
logger.debug(`
|
|
18
|
+
noVltSync () {
|
|
19
|
+
const status = this.vlt.statusSync()
|
|
20
|
+
logger.debug(`vlt: ${status}`)
|
|
21
21
|
return status === 'off'
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -4,8 +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
8
|
|
|
8
|
-
class
|
|
9
|
+
class Vlt {
|
|
9
10
|
async status () {
|
|
10
11
|
if (this._isForcedOff()) return 'off'
|
|
11
12
|
|
|
@@ -156,16 +157,12 @@ class Ops {
|
|
|
156
157
|
if (this._binaryPromise) return this._binaryPromise
|
|
157
158
|
|
|
158
159
|
this._binaryPromise = (async () => {
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
try {
|
|
166
|
-
await this._exec('dotenvx-ops', ['--version'])
|
|
167
|
-
return 'dotenvx-ops'
|
|
168
|
-
} catch (_e) {}
|
|
160
|
+
for (const binary of this._binaryCandidates()) {
|
|
161
|
+
try {
|
|
162
|
+
await this._exec(binary, ['--version'])
|
|
163
|
+
return binary
|
|
164
|
+
} catch (_e) {}
|
|
165
|
+
}
|
|
169
166
|
|
|
170
167
|
return null
|
|
171
168
|
})()
|
|
@@ -176,30 +173,30 @@ class Ops {
|
|
|
176
173
|
_resolveBinarySync () {
|
|
177
174
|
if (this._binarySync !== undefined) return this._binarySync
|
|
178
175
|
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
try {
|
|
189
|
-
this._execSync('dotenvx-ops', ['--version'])
|
|
190
|
-
this._binarySync = 'dotenvx-ops'
|
|
191
|
-
return this._binarySync
|
|
192
|
-
} catch (err) {
|
|
193
|
-
logger.debug(err.message)
|
|
176
|
+
for (const binary of this._binaryCandidates()) {
|
|
177
|
+
try {
|
|
178
|
+
this._execSync(binary, ['--version'])
|
|
179
|
+
this._binarySync = binary
|
|
180
|
+
return this._binarySync
|
|
181
|
+
} catch (err) {
|
|
182
|
+
logger.debug(err.message)
|
|
183
|
+
}
|
|
194
184
|
}
|
|
195
185
|
|
|
196
186
|
this._binarySync = null
|
|
197
187
|
return null
|
|
198
188
|
}
|
|
199
189
|
|
|
190
|
+
_binaryCandidates () {
|
|
191
|
+
return BINARY_NAMES.flatMap((binary) => [
|
|
192
|
+
path.resolve(process.cwd(), `node_modules/.bin/${binary}`),
|
|
193
|
+
binary
|
|
194
|
+
])
|
|
195
|
+
}
|
|
196
|
+
|
|
200
197
|
_isForcedOff () {
|
|
201
|
-
return process.env.DOTENVX_NO_OPS === 'true'
|
|
198
|
+
return process.env.DOTENVX_NO_OPS === 'true' || process.env.DOTENVX_NO_VLT === 'true'
|
|
202
199
|
}
|
|
203
200
|
}
|
|
204
201
|
|
|
205
|
-
module.exports =
|
|
202
|
+
module.exports = Vlt
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
vltKeypair: require('./vltKeypair'),
|
|
3
|
+
vltKeypairSync: require('./vltKeypairSync'),
|
|
4
4
|
localKeypair: require('./localKeypair'),
|
|
5
5
|
encryptValue: require('./encryptValue'),
|
|
6
6
|
decryptKeyValue: require('./decryptKeyValue'),
|
|
@@ -2,7 +2,7 @@ const FIRST_TIME_KEYS_SRC = [
|
|
|
2
2
|
'#/------------------!DOTENV_PRIVATE_KEYS!-------------------/',
|
|
3
3
|
'#/ private decryption keys. DO NOT commit to source control /',
|
|
4
4
|
'#/ [how it works](https://dotenvx.com/encryption) /',
|
|
5
|
-
|
|
5
|
+
'#/ harden private keys: `dotenvx armor up` /',
|
|
6
6
|
'#/----------------------------------------------------------/'
|
|
7
7
|
].join('\n')
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ const FIRST_TIME_KEYS_SRC = [
|
|
|
2
2
|
'#/------------------!DOTENV_PRIVATE_KEYS!-------------------/',
|
|
3
3
|
'#/ private decryption keys. DO NOT commit to source control /',
|
|
4
4
|
'#/ [how it works](https://dotenvx.com/encryption) /',
|
|
5
|
-
|
|
5
|
+
'#/ harden private keys: `dotenvx armor up` /',
|
|
6
6
|
'#/----------------------------------------------------------/'
|
|
7
7
|
].join('\n')
|
|
8
8
|
|