@dotenvx/dotenvx-ops 0.45.1 → 0.45.2
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/package.json +1 -1
- package/src/cli/actions/armor/down.js +1 -1
- package/src/cli/actions/armor/pull.js +1 -1
- package/src/cli/commands/armor.js +2 -0
- package/src/lib/api/postArmorDown.js +5 -2
- package/src/lib/api/postArmorPull.js +5 -2
- package/src/lib/services/armorDown.js +36 -2
- package/src/lib/services/armorPull.js +36 -2
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-ops/compare/v0.45.
|
|
5
|
+
[Unreleased](https://github.com/dotenvx/dotenvx-ops/compare/v0.45.2...main)
|
|
6
|
+
|
|
7
|
+
## [0.45.2](https://github.com/dotenvx/dotenvx-ops/compare/v0.45.1...v0.45.2) (2026-05-07)
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
* Surface team selector for `down|pull` ([#68](https://github.com/dotenvx/dotenvx-ops/pull/68))
|
|
6
12
|
|
|
7
13
|
## [0.45.1](https://github.com/dotenvx/dotenvx-ops/compare/v0.45.0...v0.45.1) (2026-05-07)
|
|
8
14
|
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ async function down () {
|
|
|
17
17
|
try {
|
|
18
18
|
const devicePublicKey = sesh.devicePublicKey()
|
|
19
19
|
|
|
20
|
-
const { changed, privateKeyName } = await new ArmorDown(hostname, token, devicePublicKey, options.envFile).run()
|
|
20
|
+
const { changed, privateKeyName } = await new ArmorDown(hostname, token, devicePublicKey, options.envFile, options.team).run()
|
|
21
21
|
|
|
22
22
|
if (spinner) spinner.stop()
|
|
23
23
|
if (changed) {
|
|
@@ -17,7 +17,7 @@ async function pull () {
|
|
|
17
17
|
try {
|
|
18
18
|
const devicePublicKey = sesh.devicePublicKey()
|
|
19
19
|
|
|
20
|
-
const { changed, privateKeyName } = await new ArmorPull(hostname, token, devicePublicKey, options.envFile).run()
|
|
20
|
+
const { changed, privateKeyName } = await new ArmorPull(hostname, token, devicePublicKey, options.envFile, options.team).run()
|
|
21
21
|
|
|
22
22
|
if (spinner) spinner.stop()
|
|
23
23
|
if (changed) {
|
|
@@ -27,6 +27,7 @@ armor
|
|
|
27
27
|
.command('down')
|
|
28
28
|
.description('dearmor private key')
|
|
29
29
|
.option('-f, --env-file <path>', 'path to your env file')
|
|
30
|
+
.option('--team <team>', 'team to dearmor private key from')
|
|
30
31
|
.action(downAction)
|
|
31
32
|
|
|
32
33
|
// dotenvx-ops armor push
|
|
@@ -44,6 +45,7 @@ armor
|
|
|
44
45
|
.command('pull')
|
|
45
46
|
.description('pull armored key (into .env.keys)')
|
|
46
47
|
.option('-f, --env-file <path>', 'path to your env file')
|
|
48
|
+
.option('--team <team>', 'team to pull armored private key from')
|
|
47
49
|
.action(pullAction)
|
|
48
50
|
|
|
49
51
|
// dotenvx-ops armor rotate
|
|
@@ -4,23 +4,26 @@ const packageJson = require('../../lib/helpers/packageJson')
|
|
|
4
4
|
const normalizeToken = require('../../lib/helpers/normalizeToken')
|
|
5
5
|
|
|
6
6
|
class PostArmorDown {
|
|
7
|
-
constructor (hostname, token, devicePublicKey, publicKey) {
|
|
7
|
+
constructor (hostname, token, devicePublicKey, publicKey, team) {
|
|
8
8
|
this.hostname = hostname || 'https://ops.dotenvx.com'
|
|
9
9
|
this.token = token
|
|
10
10
|
this.devicePublicKey = devicePublicKey
|
|
11
11
|
this.publicKey = publicKey
|
|
12
|
+
this.team = team
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
async run () {
|
|
15
16
|
const token = normalizeToken(this.token)
|
|
16
17
|
const devicePublicKey = this.devicePublicKey
|
|
17
18
|
const publicKey = this.publicKey
|
|
19
|
+
const team = this.team
|
|
18
20
|
const url = `${this.hostname}/api/armor/down`
|
|
19
21
|
|
|
20
22
|
const body = {
|
|
21
23
|
device_public_key: devicePublicKey,
|
|
22
24
|
cli_version: packageJson.version,
|
|
23
|
-
public_key: publicKey
|
|
25
|
+
public_key: publicKey,
|
|
26
|
+
team
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
const resp = await http(url, {
|
|
@@ -4,23 +4,26 @@ const packageJson = require('../../lib/helpers/packageJson')
|
|
|
4
4
|
const normalizeToken = require('../../lib/helpers/normalizeToken')
|
|
5
5
|
|
|
6
6
|
class PostArmorPull {
|
|
7
|
-
constructor (hostname, token, devicePublicKey, publicKey) {
|
|
7
|
+
constructor (hostname, token, devicePublicKey, publicKey, team) {
|
|
8
8
|
this.hostname = hostname || 'https://ops.dotenvx.com'
|
|
9
9
|
this.token = token
|
|
10
10
|
this.devicePublicKey = devicePublicKey
|
|
11
11
|
this.publicKey = publicKey
|
|
12
|
+
this.team = team
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
async run () {
|
|
15
16
|
const token = normalizeToken(this.token)
|
|
16
17
|
const devicePublicKey = this.devicePublicKey
|
|
17
18
|
const publicKey = this.publicKey
|
|
19
|
+
const team = this.team
|
|
18
20
|
const url = `${this.hostname}/api/armor/pull`
|
|
19
21
|
|
|
20
22
|
const body = {
|
|
21
23
|
device_public_key: devicePublicKey,
|
|
22
24
|
cli_version: packageJson.version,
|
|
23
|
-
public_key: publicKey
|
|
25
|
+
public_key: publicKey,
|
|
26
|
+
team
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
const resp = await http(url, {
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
const dotenvx = require('@dotenvx/dotenvx')
|
|
2
|
+
const prompts = require('@inquirer/prompts')
|
|
2
3
|
const PostArmorDown = require('../api/postArmorDown')
|
|
3
4
|
const keyNamesForEnvFile = require('../helpers/keyNamesForEnvFile')
|
|
4
5
|
const upsertEnvKey = require('../helpers/upsertEnvKey')
|
|
5
6
|
|
|
7
|
+
function teamChoicesFromMeta (meta) {
|
|
8
|
+
return meta.organizations.map(org => ({
|
|
9
|
+
name: org.provider_slug,
|
|
10
|
+
value: org.provider_slug
|
|
11
|
+
}))
|
|
12
|
+
}
|
|
13
|
+
|
|
6
14
|
class ArmorDown {
|
|
7
|
-
constructor (hostname, token, devicePublicKey, envFile = '.env') {
|
|
15
|
+
constructor (hostname, token, devicePublicKey, envFile = '.env', team = undefined) {
|
|
8
16
|
this.hostname = hostname
|
|
9
17
|
this.token = token
|
|
10
18
|
this.devicePublicKey = devicePublicKey
|
|
11
19
|
this.envFile = envFile
|
|
20
|
+
this.team = team
|
|
12
21
|
}
|
|
13
22
|
|
|
14
23
|
async run () {
|
|
@@ -16,6 +25,7 @@ class ArmorDown {
|
|
|
16
25
|
const token = this.token
|
|
17
26
|
const devicePublicKey = this.devicePublicKey
|
|
18
27
|
const envFile = this.envFile
|
|
28
|
+
const team = this.team
|
|
19
29
|
|
|
20
30
|
const {
|
|
21
31
|
publicKeyName,
|
|
@@ -23,7 +33,31 @@ class ArmorDown {
|
|
|
23
33
|
} = keyNamesForEnvFile(envFile)
|
|
24
34
|
|
|
25
35
|
const publicKey = dotenvx.get(publicKeyName, { path: envFile, strict: true, ignore: ['MISSING_PRIVATE_KEY'], noOps: true })
|
|
26
|
-
|
|
36
|
+
let json
|
|
37
|
+
|
|
38
|
+
if (team) {
|
|
39
|
+
json = await new PostArmorDown(hostname, token, devicePublicKey, publicKey, team).run()
|
|
40
|
+
} else {
|
|
41
|
+
try {
|
|
42
|
+
json = await new PostArmorDown(hostname, token, devicePublicKey, publicKey, undefined).run()
|
|
43
|
+
} catch (error) {
|
|
44
|
+
if (error.code !== 'DOTENVX_TEAM_REQUIRED') {
|
|
45
|
+
throw error
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const choices = teamChoicesFromMeta(error.meta)
|
|
49
|
+
|
|
50
|
+
let team = choices[0].value
|
|
51
|
+
if (choices.length > 1) {
|
|
52
|
+
team = await prompts.select({
|
|
53
|
+
message: 'Select team',
|
|
54
|
+
choices
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
json = await new PostArmorDown(hostname, token, devicePublicKey, publicKey, team).run()
|
|
59
|
+
}
|
|
60
|
+
}
|
|
27
61
|
|
|
28
62
|
upsertEnvKey(privateKeyName, json.private_key)
|
|
29
63
|
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
const dotenvx = require('@dotenvx/dotenvx')
|
|
2
|
+
const prompts = require('@inquirer/prompts')
|
|
2
3
|
const PostArmorPull = require('../api/postArmorPull')
|
|
3
4
|
const upsertEnvKey = require('../helpers/upsertEnvKey')
|
|
4
5
|
const keyNamesForEnvFile = require('../helpers/keyNamesForEnvFile')
|
|
5
6
|
|
|
7
|
+
function teamChoicesFromMeta (meta) {
|
|
8
|
+
return meta.organizations.map(org => ({
|
|
9
|
+
name: org.provider_slug,
|
|
10
|
+
value: org.provider_slug
|
|
11
|
+
}))
|
|
12
|
+
}
|
|
13
|
+
|
|
6
14
|
class ArmorPull {
|
|
7
|
-
constructor (hostname, token, devicePublicKey, envFile = '.env') {
|
|
15
|
+
constructor (hostname, token, devicePublicKey, envFile = '.env', team = undefined) {
|
|
8
16
|
this.hostname = hostname
|
|
9
17
|
this.token = token
|
|
10
18
|
this.devicePublicKey = devicePublicKey
|
|
11
19
|
this.envFile = envFile
|
|
20
|
+
this.team = team
|
|
12
21
|
}
|
|
13
22
|
|
|
14
23
|
async run () {
|
|
@@ -16,6 +25,7 @@ class ArmorPull {
|
|
|
16
25
|
const token = this.token
|
|
17
26
|
const devicePublicKey = this.devicePublicKey
|
|
18
27
|
const envFile = this.envFile
|
|
28
|
+
const team = this.team
|
|
19
29
|
|
|
20
30
|
const {
|
|
21
31
|
publicKeyName,
|
|
@@ -23,7 +33,31 @@ class ArmorPull {
|
|
|
23
33
|
} = keyNamesForEnvFile(envFile)
|
|
24
34
|
|
|
25
35
|
const publicKey = dotenvx.get(publicKeyName, { path: envFile, strict: true, ignore: ['MISSING_PRIVATE_KEY'], noOps: true })
|
|
26
|
-
|
|
36
|
+
let json
|
|
37
|
+
|
|
38
|
+
if (team) {
|
|
39
|
+
json = await new PostArmorPull(hostname, token, devicePublicKey, publicKey, team).run()
|
|
40
|
+
} else {
|
|
41
|
+
try {
|
|
42
|
+
json = await new PostArmorPull(hostname, token, devicePublicKey, publicKey, undefined).run()
|
|
43
|
+
} catch (error) {
|
|
44
|
+
if (error.code !== 'DOTENVX_TEAM_REQUIRED') {
|
|
45
|
+
throw error
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const choices = teamChoicesFromMeta(error.meta)
|
|
49
|
+
|
|
50
|
+
let team = choices[0].value
|
|
51
|
+
if (choices.length > 1) {
|
|
52
|
+
team = await prompts.select({
|
|
53
|
+
message: 'Select team',
|
|
54
|
+
choices
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
json = await new PostArmorPull(hostname, token, devicePublicKey, publicKey, team).run()
|
|
59
|
+
}
|
|
60
|
+
}
|
|
27
61
|
|
|
28
62
|
const result = upsertEnvKey(privateKeyName, json.private_key)
|
|
29
63
|
|