@dotenvx/dotenvx-ops 0.21.0 → 0.22.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 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.21.0...main)
5
+ [Unreleased](https://github.com/dotenvx/dotenvx-ops/compare/v0.22.0...main)
6
+
7
+ ## [0.22.0](https://github.com/dotenvx/dotenvx-ops/compare/v0.21.0...v0.22.0) (2025-11-26)
8
+
9
+ ### Added
10
+
11
+ * Add `get` command for getting rotation tokens: `dotenvx get rot://gh/<slug>/NPM_TOKEN` ([#](https://github.com/dotenvx/dotenvx-ops/pull/7))
6
12
 
7
13
  ## [0.21.0](https://github.com/dotenvx/dotenvx-ops/compare/v0.20.2...v0.21.0) (2025-10-11)
8
14
 
package/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  [![dotenvx-ops](https://dotenvx.com/dotenvx-ops-banner.png?v=2)](https://dotenvx.com/ops)
2
2
 
3
- > Dotenvx Ops is commercial tooling for [dotenvx](https://github.com/dotenvx/dotenvx).
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
@@ -1,7 +1,7 @@
1
1
  {
2
- "version": "0.21.0",
2
+ "version": "0.22.0",
3
3
  "name": "@dotenvx/dotenvx-ops",
4
- "description": "Dotenvx Ops",
4
+ "description": "Dotenvx Ops – commercial tooling for .env files",
5
5
  "author": "@motdotla",
6
6
  "keywords": [
7
7
  "dotenv",
@@ -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
@@ -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
  }