@dotenvx/dotenvx-ops 0.21.0 → 0.22.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 +19 -1
- package/README.md +1 -3
- package/package.json +2 -2
- package/src/cli/actions/get.js +32 -0
- package/src/cli/dotenvx-ops.js +10 -0
- package/src/lib/api/postGet.js +37 -0
- package/src/lib/main.js +19 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,25 @@
|
|
|
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.
|
|
5
|
+
[Unreleased](https://github.com/dotenvx/dotenvx-ops/compare/v0.22.2...main)
|
|
6
|
+
|
|
7
|
+
## [0.22.2](https://github.com/dotenvx/dotenvx-ops/compare/v0.22.1...v0.22.2) (2025-12-01)
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
* Fix reference to `NODE_AUTH_TOKEN` during publish process
|
|
12
|
+
|
|
13
|
+
## [0.22.1](https://github.com/dotenvx/dotenvx-ops/compare/v0.22.0...v0.22.1) (2025-12-01)
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
* NPM publish process uses dotenvx ROT token - for auto-rotating npm tokens.
|
|
18
|
+
|
|
19
|
+
## [0.22.0](https://github.com/dotenvx/dotenvx-ops/compare/v0.21.0...v0.22.0) (2025-11-26)
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
* Add `get` command for getting rotation tokens: `dotenvx get rot://gh/<slug>/NPM_TOKEN` ([#](https://github.com/dotenvx/dotenvx-ops/pull/7))
|
|
6
24
|
|
|
7
25
|
## [0.21.0](https://github.com/dotenvx/dotenvx-ops/compare/v0.20.2...v0.21.0) (2025-10-11)
|
|
8
26
|
|
package/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
[](https://dotenvx.com/ops)
|
|
2
2
|
|
|
3
|
-
> Dotenvx Ops is commercial tooling for
|
|
4
|
-
|
|
5
|
-
*Use dotenvx across your team, infrastructure, agents, and more.*
|
|
3
|
+
> Dotenvx Ops is commercial tooling for .env files.
|
|
6
4
|
|
|
7
5
|
[Learn more](https://dotenvx.com/docs/ops)
|
|
8
6
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const { logger } = require('@dotenvx/dotenvx')
|
|
2
|
+
|
|
3
|
+
const main = require('./../../lib/main')
|
|
4
|
+
|
|
5
|
+
async function get (uri) {
|
|
6
|
+
// debug opts
|
|
7
|
+
const options = this.opts()
|
|
8
|
+
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
9
|
+
|
|
10
|
+
const hostname = options.hostname
|
|
11
|
+
const token = options.token
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
const value = await main.get(uri, { hostname, token })
|
|
15
|
+
process.stdout.write(value)
|
|
16
|
+
} catch (error) {
|
|
17
|
+
if (error.message) {
|
|
18
|
+
logger.error(error.message)
|
|
19
|
+
} else {
|
|
20
|
+
logger.error(error)
|
|
21
|
+
}
|
|
22
|
+
if (error.help) {
|
|
23
|
+
logger.help(error.help)
|
|
24
|
+
}
|
|
25
|
+
if (error.stack) {
|
|
26
|
+
logger.debug(error.stack)
|
|
27
|
+
}
|
|
28
|
+
process.exit(1)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = get
|
package/src/cli/dotenvx-ops.js
CHANGED
|
@@ -44,6 +44,16 @@ program.command('observe')
|
|
|
44
44
|
observeAction.apply(this, args)
|
|
45
45
|
})
|
|
46
46
|
|
|
47
|
+
// dotenvx-ops get
|
|
48
|
+
const getAction = require('./actions/get')
|
|
49
|
+
program
|
|
50
|
+
.command('get')
|
|
51
|
+
.description('fetch secret')
|
|
52
|
+
.argument('URI', 'URI')
|
|
53
|
+
.option('--hostname <url>', 'set hostname', sesh.hostname())
|
|
54
|
+
.option('--token <token>', 'set token')
|
|
55
|
+
.action(getAction)
|
|
56
|
+
|
|
47
57
|
// dotenvx-ops sync
|
|
48
58
|
const syncAction = require('./actions/sync')
|
|
49
59
|
program
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const { http } = require('../../lib/helpers/http')
|
|
2
|
+
const buildApiError = require('../../lib/helpers/buildApiError')
|
|
3
|
+
|
|
4
|
+
class PostGet {
|
|
5
|
+
constructor (hostname, token, uri) {
|
|
6
|
+
this.hostname = hostname || 'https://ops.dotenvx.com'
|
|
7
|
+
this.token = token
|
|
8
|
+
this.uri = uri
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async run () {
|
|
12
|
+
const token = this.token
|
|
13
|
+
const uri = this.uri
|
|
14
|
+
const url = `${this.hostname}/api/get`
|
|
15
|
+
|
|
16
|
+
const resp = await http(url, {
|
|
17
|
+
method: 'POST',
|
|
18
|
+
headers: {
|
|
19
|
+
Authorization: `Bearer ${token}`,
|
|
20
|
+
'Content-Type': 'application/json'
|
|
21
|
+
},
|
|
22
|
+
body: JSON.stringify({
|
|
23
|
+
uri
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
if (resp.statusCode >= 400) {
|
|
28
|
+
const json = await resp.body.json()
|
|
29
|
+
throw buildApiError(resp.statusCode, json)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const text = await resp.body.text()
|
|
33
|
+
return text
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = PostGet
|
package/src/lib/main.js
CHANGED
|
@@ -3,6 +3,7 @@ const dotenvx = require('@dotenvx/dotenvx')
|
|
|
3
3
|
|
|
4
4
|
const Session = require('./../db/session')
|
|
5
5
|
const PostObserve = require('./api/postObserve')
|
|
6
|
+
const PostGet = require('./api/postGet')
|
|
6
7
|
|
|
7
8
|
const gitUrl = require('./helpers/gitUrl')
|
|
8
9
|
const gitBranch = require('./helpers/gitBranch')
|
|
@@ -39,12 +40,30 @@ const observe = async function (encoded, options = {}) {
|
|
|
39
40
|
return json
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
const get = async function (uri, options = {}) {
|
|
44
|
+
const sesh = new Session() // TODO: handle scenario where constructor fails
|
|
45
|
+
|
|
46
|
+
let hostname = process.env.DOTENVX_OPS_HOSTNAME || process.env.DOTENVX_RADAR_HOSTNAME || options.hostname
|
|
47
|
+
if (!hostname) {
|
|
48
|
+
hostname = sesh.hostname()
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let token = process.env.DOTENVX_OPS_TOKEN || process.env.DOTENVX_RADAR_TOKEN || options.token
|
|
52
|
+
if (!token) {
|
|
53
|
+
token = sesh.token()
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const value = await new PostGet(hostname, token, uri).run()
|
|
57
|
+
return value
|
|
58
|
+
}
|
|
59
|
+
|
|
42
60
|
const config = function (options = {}) {
|
|
43
61
|
return dotenvx.config(options)
|
|
44
62
|
}
|
|
45
63
|
|
|
46
64
|
module.exports = {
|
|
47
65
|
observe,
|
|
66
|
+
get,
|
|
48
67
|
// dotenv proxies
|
|
49
68
|
config
|
|
50
69
|
}
|