@toa.io/cli 0.20.0-dev.12 → 0.20.0-dev.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/cli",
3
- "version": "0.20.0-dev.12",
3
+ "version": "0.20.0-dev.14",
4
4
  "description": "Toa CLI",
5
5
  "author": "temich <tema.gurtovoy@gmail.com>",
6
6
  "homepage": "https://github.com/toa-io/toa#readme",
@@ -22,14 +22,14 @@
22
22
  "@toa.io/runtime": "*"
23
23
  },
24
24
  "dependencies": {
25
- "@toa.io/console": "0.20.0-dev.13",
26
- "@toa.io/generic": "0.20.0-dev.13",
27
- "@toa.io/kubernetes": "0.20.0-dev.13",
28
- "@toa.io/norm": "0.20.0-dev.13",
29
- "@toa.io/yaml": "0.20.0-dev.13",
25
+ "@toa.io/console": "0.20.0-dev.15",
26
+ "@toa.io/generic": "0.20.0-dev.15",
27
+ "@toa.io/kubernetes": "0.20.0-dev.15",
28
+ "@toa.io/norm": "0.20.0-dev.15",
29
+ "@toa.io/yaml": "0.20.0-dev.15",
30
30
  "dotenv": "16.1.1",
31
31
  "find-up": "5.0.0",
32
32
  "yargs": "17.6.2"
33
33
  },
34
- "gitHead": "73a02a4a471d9c62d2437df1065fc037b7eb7279"
34
+ "gitHead": "59b98b392985c2fb6ed8714e160f75a61c65d4b8"
35
35
  }
package/readme.md CHANGED
@@ -124,12 +124,24 @@ Pods [are ready](https://helm.sh/docs/intro/using_helm/#helpful-options-for-inst
124
124
 
125
125
  ### conceal
126
126
 
127
- Deploy a `key` with a `value` to a secret named `toa-{secret}`.
127
+ Deploy a generic Kubernetes secret with the prefix `toa-`.
128
128
 
129
129
  <dl>
130
- <dt><code>toa conceal &lt;secret&gt; &lt;key&gt; &lt;value&gt;</code></dt>
130
+ <dt><code>toa conceal &lt;secret&gt; &lt;key-values...&gt;</code></dt>
131
+ <dd>
132
+ <code>secret</code> Secret name.<br/>
133
+ <code>key-values</code> List of keys and values of the secret as <code>key=value</code>.<br/>
134
+ </dd>
131
135
  </dl>
132
136
 
137
+ > Existing secret will be replaced.
138
+
139
+ #### Example
140
+
141
+ ```shell
142
+ $ toa conceal bindings-amqp-default username=developer password=secret
143
+ ```
144
+
133
145
  ### reveal
134
146
 
135
147
  Outputs keys and values of a secret.
@@ -7,15 +7,25 @@ const builder = (yargs) => {
7
7
  .positional('secret', {
8
8
  type: 'string'
9
9
  })
10
- .positional('key', {
11
- type: 'string'
10
+ .positional('key-values', {
11
+ type: 'string',
12
+ array: true,
13
+ desc: 'Secret key-value pairs'
12
14
  })
13
- .positional('value', {
14
- type: 'string'
15
+ .option('namespace', {
16
+ alias: 'n',
17
+ group: 'Command options:',
18
+ type: 'string',
19
+ desc: 'Target Kubernetes namespace'
15
20
  })
21
+ .example([
22
+ ['$0 conceal amqp-credentials username=developer'],
23
+ ['$0 conceal amqp-credentials username=developer password=secret'],
24
+ ['$0 conceal amqp-credentials username=developer --namespace app']
25
+ ])
16
26
  }
17
27
 
18
- exports.command = 'conceal <secret> <key> <value>'
19
- exports.desc = 'Deploy a key with a value to a secret'
28
+ exports.command = 'conceal <secret> <key-values...>'
29
+ exports.desc = 'Deploy a secret'
20
30
  exports.builder = builder
21
31
  exports.handler = conceal
@@ -3,10 +3,17 @@
3
3
  const { secrets } = require('@toa.io/kubernetes')
4
4
 
5
5
  const conceal = async (argv) => {
6
- const { secret, key, value } = argv
7
- const prefixed = PREFIX + secret
6
+ const values = argv['key-values'].reduce((values, pair) => {
7
+ const [key, value] = pair.split('=')
8
8
 
9
- await secrets.store(prefixed, { [key]: value })
9
+ values[key] = value
10
+
11
+ return values
12
+ }, {})
13
+
14
+ const secret = PREFIX + argv.secret
15
+
16
+ await secrets.store(secret, values, argv.namespace)
10
17
  }
11
18
 
12
19
  const PREFIX = 'toa-'