@dotenvx/dotenvx 1.68.1 → 1.69.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 +14 -14
- package/package.json +3 -3
- package/src/cli/actions/decrypt.js +3 -2
- package/src/cli/actions/encrypt.js +3 -2
- package/src/cli/actions/get.js +3 -2
- package/src/cli/actions/keypair.js +3 -2
- package/src/cli/actions/normalizeVltOptions.js +10 -0
- package/src/cli/actions/rotate.js +3 -2
- package/src/cli/actions/run.js +3 -2
- package/src/cli/actions/set.js +3 -2
- 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/opsKeypair.js +2 -2
- package/src/lib/helpers/cryptography/opsKeypairSync.js +2 -2
- package/src/lib/helpers/executeDynamic.js +31 -1
- package/src/lib/main.d.ts +21 -9
- package/src/lib/main.js +1 -1
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.69.0...main)
|
|
6
|
+
|
|
7
|
+
## [1.69.0](https://github.com/dotenvx/dotenvx/compare/v1.68.1...v1.69.0) (2026-05-25)
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
* Remove fully-deprecated `opsOff` option in favor of `noOps` ([#822](https://github.com/dotenvx/dotenvx/pull/822))
|
|
6
12
|
|
|
7
13
|
## [1.68.1](https://github.com/dotenvx/dotenvx/compare/v1.68.0...v1.68.1) (2026-05-24)
|
|
8
14
|
|
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.0",
|
|
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 noOps = options.ops === false || (await sesh.
|
|
18
|
+
const noOps = options.ops === false || (await sesh.noVlt())
|
|
18
19
|
|
|
19
20
|
let errorCount = 0
|
|
20
21
|
|
|
@@ -8,6 +8,7 @@ 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
14
|
let stoppedForOps = false
|
|
@@ -64,14 +65,14 @@ 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 noOps = options.ops === false || (!options.token && (await sesh.
|
|
75
|
+
const noOps = options.ops === 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
|
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,7 +30,7 @@ async function get (key) {
|
|
|
29
30
|
|
|
30
31
|
try {
|
|
31
32
|
const sesh = new Session()
|
|
32
|
-
const noOps = options.ops === false || (await sesh.
|
|
33
|
+
const noOps = options.ops === false || (await sesh.noVlt())
|
|
33
34
|
const { parsed, errors } = await new Get(key, envs, options.overload, options.all, options.envKeysFile, noOps).run()
|
|
34
35
|
|
|
35
36
|
for (const error of errors || []) {
|
|
@@ -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,7 +17,7 @@ async function keypair (key) {
|
|
|
16
17
|
const prettyPrint = options.prettyPrint || options.pp
|
|
17
18
|
|
|
18
19
|
const sesh = new Session()
|
|
19
|
-
const noOps = options.ops === false || await sesh.
|
|
20
|
+
const noOps = options.ops === false || await sesh.noVlt()
|
|
20
21
|
const keypairs = await new Keypair(options.envFile, options.envKeysFile, noOps).run()
|
|
21
22
|
const results = key ? keypairs[key] : keypairs
|
|
22
23
|
|
|
@@ -7,16 +7,17 @@ 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 noOps = options.ops === false || (await sesh.
|
|
20
|
+
const noOps = options.ops === 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) {
|
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 noOps = options.ops === false ||
|
|
25
|
+
const noOps = options.ops === false || (await sesh.noVlt())
|
|
25
26
|
|
|
26
27
|
if (commandArgs.length < 1) {
|
|
27
28
|
if (spinner) spinner.stop()
|
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,7 +28,7 @@ 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 noOps = options.ops === false || (await sesh.
|
|
31
|
+
const noOps = options.ops === false || (await sesh.noVlt())
|
|
31
32
|
const noCreate = options.create === false
|
|
32
33
|
|
|
33
34
|
const {
|
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,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Vlt = require('../../extensions/vlt')
|
|
2
2
|
|
|
3
3
|
async function opsKeypair (existingPublicKey, options = {}) {
|
|
4
4
|
const hooks = options.hooks || {}
|
|
@@ -13,7 +13,7 @@ async function opsKeypair (existingPublicKey, options = {}) {
|
|
|
13
13
|
|
|
14
14
|
let kp
|
|
15
15
|
try {
|
|
16
|
-
kp = await new
|
|
16
|
+
kp = await new Vlt().keypair(existingPublicKey, keypairOptions)
|
|
17
17
|
} finally {
|
|
18
18
|
if (hooks.after) await hooks.after()
|
|
19
19
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
1
|
+
const Vlt = require('../../extensions/vlt')
|
|
2
2
|
|
|
3
3
|
function opsKeypairSync (existingPublicKey, options = {}) {
|
|
4
|
-
const kp = new
|
|
4
|
+
const kp = new Vlt().keypairSync(existingPublicKey, options)
|
|
5
5
|
const publicKey = kp.public_key
|
|
6
6
|
const privateKey = kp.private_key
|
|
7
7
|
|
|
@@ -6,6 +6,10 @@ function installCommandForOps () {
|
|
|
6
6
|
return 'curl -sfS https://dotenvx.sh/ops | sh'
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
function installCommandForVlt () {
|
|
10
|
+
return 'curl -sfS https://dotenvx.sh/vlt | sh'
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
function opsBanner (installCommand) {
|
|
10
14
|
const lines = [
|
|
11
15
|
'',
|
|
@@ -29,6 +33,29 @@ function opsBanner (installCommand) {
|
|
|
29
33
|
return `${top}\n${middle}\n${bottom}`
|
|
30
34
|
}
|
|
31
35
|
|
|
36
|
+
function vltBanner (installCommand) {
|
|
37
|
+
const lines = [
|
|
38
|
+
'',
|
|
39
|
+
' ██╗ ██╗██╗ ████████╗',
|
|
40
|
+
' ██║ ██║██║ ╚══██╔══╝',
|
|
41
|
+
' ██║ ██║██║ ██║ ',
|
|
42
|
+
' ╚██╗ ██╔╝██║ ██║ [www.dotenvx.com/vlt]',
|
|
43
|
+
' ╚████╔╝ ███████╗██║ ',
|
|
44
|
+
' ╚═══╝ ╚══════╝╚═╝ ',
|
|
45
|
+
'',
|
|
46
|
+
' ⛨ ARMORED KEYS: Harden your private keys.',
|
|
47
|
+
` ⮕ install [${installCommand}]`,
|
|
48
|
+
' ⮕ then run [dotenvx-vlt login]'
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
const innerWidth = Math.max(67, ...lines.map((line) => line.length))
|
|
52
|
+
const top = ` ${'_'.repeat(innerWidth)}`
|
|
53
|
+
const middle = lines.map((line) => `|${line.padEnd(innerWidth)}|`).join('\n')
|
|
54
|
+
const bottom = `|${'_'.repeat(innerWidth)}|`
|
|
55
|
+
|
|
56
|
+
return `${top}\n${middle}\n${bottom}`
|
|
57
|
+
}
|
|
58
|
+
|
|
32
59
|
function executeDynamic (program, command, rawArgs) {
|
|
33
60
|
if (!command) {
|
|
34
61
|
program.outputHelp()
|
|
@@ -49,7 +76,10 @@ function executeDynamic (program, command, rawArgs) {
|
|
|
49
76
|
|
|
50
77
|
const result = childProcess.spawnSync(`dotenvx-${command}`, forwardedArgs, { stdio: 'inherit', env })
|
|
51
78
|
if (result.error) {
|
|
52
|
-
if (command === '
|
|
79
|
+
if (command === 'vlt') {
|
|
80
|
+
const installCommand = installCommandForVlt()
|
|
81
|
+
console.log(vltBanner(installCommand))
|
|
82
|
+
} else if (command === 'ops') {
|
|
53
83
|
const installCommand = installCommandForOps()
|
|
54
84
|
console.log(opsBanner(installCommand))
|
|
55
85
|
} else {
|
package/src/lib/main.d.ts
CHANGED
|
@@ -165,7 +165,7 @@ export interface DotenvConfigOptions {
|
|
|
165
165
|
| 'debug';
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
|
-
* Turn off Dotenvx Ops features
|
|
168
|
+
* Turn off Dotenvx Vlt Ops features. Alias for `noVlt`.
|
|
169
169
|
*
|
|
170
170
|
* @default false
|
|
171
171
|
* @example require('@dotenvx/dotenvx').config({ noOps: true })
|
|
@@ -173,9 +173,13 @@ export interface DotenvConfigOptions {
|
|
|
173
173
|
noOps?: boolean;
|
|
174
174
|
|
|
175
175
|
/**
|
|
176
|
-
*
|
|
176
|
+
* Turn off Dotenvx Vlt Ops features.
|
|
177
|
+
*
|
|
178
|
+
* @default false
|
|
179
|
+
* @example require('@dotenvx/dotenvx').config({ noVlt: true })
|
|
177
180
|
*/
|
|
178
|
-
|
|
181
|
+
noVlt?: boolean;
|
|
182
|
+
|
|
179
183
|
}
|
|
180
184
|
|
|
181
185
|
export type DotenvConfigEnv =
|
|
@@ -244,7 +248,7 @@ export interface SetOptions {
|
|
|
244
248
|
encrypt?: boolean;
|
|
245
249
|
|
|
246
250
|
/**
|
|
247
|
-
* Turn off Dotenvx Ops features
|
|
251
|
+
* Turn off Dotenvx Vlt Ops features. Alias for `noVlt`.
|
|
248
252
|
*
|
|
249
253
|
* @default false
|
|
250
254
|
* @example require('@dotenvx/dotenvx').set(key, value, { noOps: true })
|
|
@@ -252,9 +256,13 @@ export interface SetOptions {
|
|
|
252
256
|
noOps?: boolean;
|
|
253
257
|
|
|
254
258
|
/**
|
|
255
|
-
*
|
|
259
|
+
* Turn off Dotenvx Vlt Ops features.
|
|
260
|
+
*
|
|
261
|
+
* @default false
|
|
262
|
+
* @example require('@dotenvx/dotenvx').set(key, value, { noVlt: true })
|
|
256
263
|
*/
|
|
257
|
-
|
|
264
|
+
noVlt?: boolean;
|
|
265
|
+
|
|
258
266
|
}
|
|
259
267
|
|
|
260
268
|
export type SetProcessedEnv = {
|
|
@@ -325,7 +333,7 @@ export interface GetOptions {
|
|
|
325
333
|
strict?: boolean;
|
|
326
334
|
|
|
327
335
|
/**
|
|
328
|
-
* Turn off Dotenvx Ops features
|
|
336
|
+
* Turn off Dotenvx Vlt Ops features. Alias for `noVlt`.
|
|
329
337
|
*
|
|
330
338
|
* @default false
|
|
331
339
|
* @example require('@dotenvx/dotenvx').get('KEY', { noOps: true })
|
|
@@ -333,9 +341,13 @@ export interface GetOptions {
|
|
|
333
341
|
noOps?: boolean;
|
|
334
342
|
|
|
335
343
|
/**
|
|
336
|
-
*
|
|
344
|
+
* Turn off Dotenvx Vlt Ops features.
|
|
345
|
+
*
|
|
346
|
+
* @default false
|
|
347
|
+
* @example require('@dotenvx/dotenvx').get('KEY', { noVlt: true })
|
|
337
348
|
*/
|
|
338
|
-
|
|
349
|
+
noVlt?: boolean;
|
|
350
|
+
|
|
339
351
|
}
|
|
340
352
|
|
|
341
353
|
/**
|
package/src/lib/main.js
CHANGED
|
@@ -328,7 +328,7 @@ const keypair = function (envFile, key, envKeysFile = null, noOps = false) {
|
|
|
328
328
|
|
|
329
329
|
function resolveNoOps (options = {}) {
|
|
330
330
|
const sesh = new Session()
|
|
331
|
-
return options.noOps === true || options.
|
|
331
|
+
return options.noOps === true || options.noVlt === true || sesh.noVltSync()
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
module.exports = {
|