@toa.io/cli 0.20.0-dev.13 → 0.20.0-dev.15

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.13",
3
+ "version": "0.20.0-dev.15",
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.14",
26
- "@toa.io/generic": "0.20.0-dev.14",
27
- "@toa.io/kubernetes": "0.20.0-dev.14",
28
- "@toa.io/norm": "0.20.0-dev.14",
29
- "@toa.io/yaml": "0.20.0-dev.14",
25
+ "@toa.io/console": "0.20.0-dev.16",
26
+ "@toa.io/generic": "0.20.0-dev.16",
27
+ "@toa.io/kubernetes": "0.20.0-dev.16",
28
+ "@toa.io/norm": "0.20.0-dev.16",
29
+ "@toa.io/yaml": "0.20.0-dev.16",
30
30
  "dotenv": "16.1.1",
31
31
  "find-up": "5.0.0",
32
32
  "yargs": "17.6.2"
33
33
  },
34
- "gitHead": "bb2aed156c9e6b76bb802628bb249d4dd7adcebe"
34
+ "gitHead": "ea33b54b708fe3f97949143c72c5e1d6606fd5ec"
35
35
  }
package/readme.md CHANGED
@@ -124,12 +124,25 @@ 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
+ <code>--namespace</code> Kubernetes namespace where the secret should be deployed.
135
+ </dd>
131
136
  </dl>
132
137
 
138
+ > Existing secret will be replaced.
139
+
140
+ #### Example
141
+
142
+ ```shell
143
+ $ toa conceal bindings-amqp-default username=developer password=secret
144
+ ```
145
+
133
146
  ### reveal
134
147
 
135
148
  Outputs keys and values of a secret.
@@ -149,12 +162,13 @@ Run interactive shell inside a disposable pod inside a Kubernetes cluster.
149
162
  <code>toa shell [image]</code>
150
163
  </dt>
151
164
  <dd>
152
- <code>image</code> Docker image<br/>
165
+ <code>image</code> Docker image to Run (default <code>alpine</code>).<br/>
153
166
  </dd>
154
167
  </dl>
155
168
 
156
- Extra arguments can be passed:
169
+ #### Examples
157
170
 
158
171
  ```shell
159
- $ toa shell -- ping 1.1
172
+ $ toa shell mongo
173
+ $ toa shell -- ping 1.1 # extra arguments can be passed
160
174
  ```
@@ -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-'