1 | | LINTING | UNIT | INTEGRATION | NPM SECURITY |
|
2 | |-------------------|-------------------|-------------------|-------------------|
|
3 | | [![Build1][1]][5] | [![Build2][2]][5] | [![Build3][3]][5] | [![Build4][4]][5] |
|
4 |
|
5 | [1]: https://travis-matrix-badges.herokuapp.com/repos/Kinvey/kinvey-cli/branches/master/1
|
6 | [2]: https://travis-matrix-badges.herokuapp.com/repos/Kinvey/kinvey-cli/branches/master/2
|
7 | [3]: https://travis-matrix-badges.herokuapp.com/repos/Kinvey/kinvey-cli/branches/master/3
|
8 | [4]: https://travis-matrix-badges.herokuapp.com/repos/Kinvey/kinvey-cli/branches/master/4
|
9 | [5]: https://travis-ci.org/Kinvey/kinvey-cli
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | # Kinvey CLI
|
15 |
|
16 | Kinvey CLI is a utility for managing various aspects of your Kinvey account from the command line. Its features include:
|
17 |
|
18 | * Deploying and managing FlexServices running on the Kinvey FlexService Runtime
|
19 | * Creating, listing, and deleting applications
|
20 | * Creating, listing, and deleting app environments
|
21 | * Creating, listing, and deleting collections
|
22 |
|
23 | Contents:
|
24 |
|
25 | - [Installation](#installation)
|
26 | - [Usage](#usage)
|
27 | - [Commands](#commands)
|
28 | - [Global Options](#global-options)
|
29 | - [Environment Variables](#environment-variables)
|
30 | - [Getting Help](#getting-help)
|
31 | - [Getting Started](#getting-started)
|
32 | - [Managing Profiles](#managing-profiles)
|
33 | - [Authenticating One-time Commands](#authenticating-one-time-commands)
|
34 | - [Precedence of Configuration Options](#precedence-of-configuration-options)
|
35 | - [Output Format](#output-format)
|
36 | - [Flex Runtime Version Selection](#flex-runtime-version-selection)
|
37 | - [Proxy Settings](#proxy-settings)
|
38 | - [Troubleshooting](#troubleshooting)
|
39 | - [Changelog](#changelog)
|
40 | - [License](#license)
|
41 |
|
42 |
|
43 |
|
44 | ## Installation
|
45 |
|
46 | Kinvey CLI is distributed as an NPM package. After you install NPM, run the following command to download and install Kinvey CLI.
|
47 |
|
48 | npm install -g kinvey-cli
|
49 |
|
50 | ## Usage
|
51 |
|
52 | kinvey <command> [args] [options]
|
53 |
|
54 | ## Commands
|
55 |
|
56 | * `init`
|
57 |
|
58 | Prompts you to provide account credentials and instance ID and creates a new working profile for you based on the information you provided. Command-line options that specify the same data are ignored.
|
59 |
|
60 | * `profile create <name> [profile information]`
|
61 |
|
62 | Creates a profile with the specified name. You can specify the profile information either at the command line as arguments or as environment variables. In the presence of command line argument, any values specified through environment variables are ignored.
|
63 |
|
64 | * `profile list`
|
65 |
|
66 | Lists all existing profiles. Profiles are saved under the user home.
|
67 |
|
68 | * `profile login [name]`
|
69 |
|
70 | Re-authenticates a specified profile. If you omit the profile name, the active profile is used. Prompts for password and for two-factor authentication token if needed.
|
71 |
|
72 | * `profile show [name]`
|
73 |
|
74 | Shows detailed information about the specified profile. If you omit the profile name, information about the active profile is shown.
|
75 |
|
76 | * `profile use <name>`
|
77 |
|
78 | Sets an active profile.
|
79 |
|
80 | * `profile delete [name]`
|
81 |
|
82 | Deletes the specified profile or the active one if you don't specify a profile name.
|
83 |
|
84 | * `org list`
|
85 |
|
86 | Lists all existing organizations within your Kinvey account.
|
87 |
|
88 | * `org show`
|
89 |
|
90 | Shows detailed information about the specified organization or about the active one if you don't specify an organization. You can specify an organization by ID or name.
|
91 |
|
92 | * `--org <organization>`
|
93 |
|
94 | Specifies a Kinvey organization by ID or name.
|
95 |
|
96 | * `org use <org>`
|
97 |
|
98 | Sets the specified organization as active. You can specify an organization by ID or name.
|
99 |
|
100 | * `app create <name>`
|
101 |
|
102 | Creates an application. You can specify an organization ID or name if you want to create the app within the context of an organization.
|
103 |
|
104 | * `--org <organization>`
|
105 |
|
106 | Specifies a Kinvey organization by ID or name.
|
107 |
|
108 | * `app list`
|
109 |
|
110 | Lists all existing applications within your Kinvey account.
|
111 |
|
112 | * `app show`
|
113 |
|
114 | Shows detailed information about the specified application or about the active one if you don't specify an application.
|
115 |
|
116 | * `--app <application>`
|
117 |
|
118 | Specifies a Kinvey app by ID or name.
|
119 |
|
120 | * `app use <app>`
|
121 |
|
122 | Sets the specified application as active. You can specify an application by ID or name.
|
123 |
|
124 | * `app delete`
|
125 |
|
126 | Deletes the specified application or the active one if you don't specify an application. You will be prompted for confirmation unless you set the `--no-prompt` flag.
|
127 |
|
128 | * `--app <application>`
|
129 |
|
130 | Specifies a Kinvey app by ID or name.
|
131 |
|
132 | * `--no-prompt`
|
133 |
|
134 | Do not ask for confirmation.
|
135 |
|
136 | * `appenv create <name>`
|
137 |
|
138 | Creates an environment within the active application. To use a different application, specify it using `--app`.
|
139 |
|
140 | * `--app <application>`
|
141 |
|
142 | Specifies a Kinvey app by ID or name.
|
143 |
|
144 | * `appenv show`
|
145 |
|
146 | Shows detailed information about the specified environment or about the active one if you don't specify an environment. By default, the command searches inside the active application but you can specify a different application using `--app`.
|
147 |
|
148 | * `--env <environment>`
|
149 |
|
150 | Specifies a Kinvey app environment by ID or name.
|
151 |
|
152 | * `--app <application>`
|
153 |
|
154 | Specifies a Kinvey app by ID or name.
|
155 |
|
156 | * `appenv use <env>`
|
157 |
|
158 | Sets the specified environment as active. By default, the command searches inside the active application but you can specify a different application using `--app`.
|
159 |
|
160 | * `--app <application>`
|
161 |
|
162 | Specifies a Kinvey app by ID or name.
|
163 |
|
164 | * `appenv delete`
|
165 |
|
166 | Deletes the specified environment or the active one if you don't specify an environment. By default, the command searches inside the active application but you can specify a different application using `--app`. You will be prompted for confirmation unless you set the `--no-prompt` flag.
|
167 |
|
168 | * `--env <environment>`
|
169 |
|
170 | Specifies a Kinvey app environment by ID or name.
|
171 |
|
172 | * `--app <application>`
|
173 |
|
174 | Specifies a Kinvey app by ID or name.
|
175 |
|
176 | * `--no-prompt`
|
177 |
|
178 | Do not ask for confirmation.
|
179 |
|
180 | * `coll create <name>`
|
181 |
|
182 | Creates a collection within the active application and environment. You can specify another pair of application and environment using the `--app` and `--env` options.
|
183 |
|
184 | * `--app <application>`
|
185 |
|
186 | Specifies a Kinvey app by ID or name. Requires `--env`.
|
187 |
|
188 | * `--env <environment>`
|
189 |
|
190 | Specifies a Kinvey app environment by ID or name.
|
191 |
|
192 | * `coll list`
|
193 |
|
194 | Lists all existing collections within the active application and environment. You can specify another pair of application and environment using the `--app` and `--env` options.
|
195 |
|
196 | * `--app <application>`
|
197 |
|
198 | Specifies a Kinvey app by ID or name. Requires `--env`.
|
199 |
|
200 | * `--env <environment>`
|
201 |
|
202 | Specifies a Kinvey app environment by ID or name.
|
203 |
|
204 | * `coll delete <coll>`
|
205 |
|
206 | Deletes a collection by name within the active application and environment. You can specify another pair of application and environment using the `--app` and `--env` options. You will be prompted for confirmation unless you set the `--no-prompt` flag.
|
207 |
|
208 | * `--app <application>`
|
209 |
|
210 | Specifies a Kinvey app by ID or name. Requires `--env`.
|
211 |
|
212 | * `--env <environment>`
|
213 |
|
214 | Specifies a Kinvey app environment by ID or name.
|
215 |
|
216 | * `--no-prompt`
|
217 |
|
218 | Do not ask for confirmation.
|
219 |
|
220 | * `flex init`
|
221 |
|
222 | Configures Kinvey CLI to work with a specific Flex service and service environment combination through prompts. This command is designed to be executed in a Node.js project directory where it creates a `.kinvey` configuration file. Information within the file is saved per profile. Each successive execution in the same directory overwrites the respective profile section in the configuration file. This command requires that either an active profile is set or a profile is specified using the `--profile` option. Profile data options such as `--email`, `--password`, and `--instanceId` are ignored if specified.
|
223 |
|
224 | * `flex create <service_name>`
|
225 |
|
226 | Creates an internal flex service with the specified name along with a service environment. You need to specify a domain (application or organization) using the `--app` or `--org` option.
|
227 |
|
228 | * `--app <application>`
|
229 |
|
230 | Specifies a Kinvey app by ID or name.
|
231 |
|
232 | * `--org <organization>`
|
233 |
|
234 | Specifies a Kinvey organization by ID or name.
|
235 |
|
236 | * `--secret <secret>`
|
237 |
|
238 | Specifies a shared secret of your choice (minimum 2 characters, no leading or trailing whitespaces). If you skip this option, a random shared secret is generated for you. In the latter case, Kinvey CLI will pass the secret automatically to the Flex Runtime and print it on the screen for your information.
|
239 |
|
240 | * `--env <service environment name>`
|
241 |
|
242 | Specifies a name for the default service environment that will be created with the service. The name will be set to Development if you omit this option.
|
243 |
|
244 | * `--vars, --set-vars <environment variables>`
|
245 |
|
246 | Specifies environment variables to set. Specify either as a comma-separated list of key-value pairs (key1=value1,key2=value2) or in stringified JSON format.
|
247 |
|
248 | * `--runtime <node6|node8|node10>`
|
249 |
|
250 | Specifies major Node.js version to run the project on. The minor and patch versions will vary depending on the [latest Flex Runtime updates](#flex-runtime-version-selection).
|
251 |
|
252 | * `flex deploy`
|
253 |
|
254 | Deploys the current project to the Kinvey FlexService Runtime, using the current service and service environment combination, which is the one you initiated last on the current profile. To use a different service, specify its service ID.
|
255 |
|
256 | * `--service <service>`
|
257 |
|
258 | Specifies service ID.
|
259 |
|
260 | * `--env <service environment>`
|
261 |
|
262 | Specifies a service environment by ID or name.
|
263 |
|
264 | * `--replace-vars <environment variables>`
|
265 |
|
266 | Overwrite the full set of existing environment variables with a new set. Specify either as a comma-separated list of key-value pairs (key1=value1,key2=value2) or in stringified JSON format.
|
267 |
|
268 | * `--set-vars <environment variables>`
|
269 |
|
270 | Specifies environment variables to set. If any of the variables already exist on the server, they are overwritten without prompt. Specify either as a comma-separated list of key-value pairs (key1=value1,key2=value2) or in stringified JSON format.
|
271 |
|
272 | * `--runtime <node6|node8|node10>`
|
273 |
|
274 | Specifies major Node.js version to run the project on. The minor and patch versions will vary depending on the [latest Flex Runtime updates](#flex-runtime-version-selection).
|
275 |
|
276 | * `flex job [id]`
|
277 |
|
278 | Shows the job status of a deploy/recycle command. If you don't specify an `id`, the command returns the status of the most recent `flex deploy` or `flex recycle` command.
|
279 |
|
280 | * `flex status`
|
281 |
|
282 | Displays the health of the current Flex service and service environment combination, which is the one you initiated last on the current profile. To get the status of a different service, specify its service ID.
|
283 |
|
284 | * `--service <service>`
|
285 |
|
286 | Specifies service ID.
|
287 |
|
288 | * `--env <service environment>`
|
289 |
|
290 | Specifies a service environment by ID or name.
|
291 |
|
292 | * `flex show`
|
293 |
|
294 | Shows info about a service environment.
|
295 |
|
296 | * `--service <service>`
|
297 |
|
298 | Specifies service ID.
|
299 |
|
300 | * `--env <service environment>`
|
301 |
|
302 | Specifies a service environment by ID or name.
|
303 |
|
304 | * `flex list`
|
305 |
|
306 | Lists all Flex services for a domain (app or organization), excluding external Flex services. Specify domain using `--domain` and then an app or organization ID using `--id`. If you skip the domain and ID options, the command lists the services within the domain you've configured as part of running `flex init`. In addition to the global options, this command supports the following options:
|
307 |
|
308 | * `--domain <app|org>`
|
309 |
|
310 | Specifies the domain type as either `app` for application or `org` for organization.
|
311 |
|
312 | * `--id <app or organization ID>`
|
313 |
|
314 | App or organization ID for use with `--domain <app|org>`.
|
315 |
|
316 | * `flex logs`
|
317 |
|
318 | Retrieves and displays logs for the current Flex service environment. Log calls return 100 entries by default and can return up to 2,000 entries. Logs are displayed in the following format: `<runtime id> <timestamp> - <message>`. Combine with the paging and limiting options to narrow down your search. Logs for external Flex Services are not returned. In addition to the global options, this command supports the following options:
|
319 |
|
320 | * `--service <service>`
|
321 |
|
322 | Specifies service ID.
|
323 |
|
324 | * `--env <service environment>`
|
325 |
|
326 | Specifies a service environment by ID or name.
|
327 |
|
328 | * `--from`
|
329 |
|
330 | Timestamp specifying the beginning of a period for which you want to fetch log entries, in ISO 8601 format.
|
331 |
|
332 | * `--number`
|
333 |
|
334 | Number of entries to fetch, i.e. page size. The default is 100, the maximum allowed is 2000.
|
335 |
|
336 | * `--page`
|
337 |
|
338 | Page number to fetch. The first page is indexed 1.
|
339 |
|
340 | * `--to`
|
341 |
|
342 | Timestamp specifying the end of a period for which you want to fetch log entries, in ISO 8601 format.
|
343 |
|
344 | * `flex update`
|
345 |
|
346 | Updates environment variables and/or runtime environment of the current Flex service environment, which is the one you initiated last on the current profile. To specify a different service, use `--service`. The command causes restart/rebuild of the service.
|
347 |
|
348 | * `--service <service>`
|
349 |
|
350 | Specifies service ID.
|
351 |
|
352 | * `--env <service environment>`
|
353 |
|
354 | Specifies a service environment by ID or name.
|
355 |
|
356 | * `--replace-vars <environment variables>`
|
357 |
|
358 | Overwrite the full set of existing environment variables with a new set. Specify either as a comma-separated list of key-value pairs (key1=value1,key2=value2) or in stringified JSON format.
|
359 |
|
360 | * `--set-vars <environment variables>`
|
361 |
|
362 | Specifies environment variables to set. If any of the variables already exist on the server, they are overwritten without prompt. Specify either as a comma-separated list of key-value pairs (key1=value1,key2=value2) or in stringified JSON format.
|
363 |
|
364 | * `--runtime <node6|node8|node10>`
|
365 |
|
366 | Specifies major Node.js version to run the project on. The minor and patch versions will vary depending on the [latest Flex Runtime updates](#flex-runtime-version-selection).
|
367 |
|
368 | * `flex recycle`
|
369 |
|
370 | Recycles the current Flex service environment, which is the one you initiated last on the current profile. To recycle a different service, specify its service ID.
|
371 |
|
372 | * `--service <service>`
|
373 |
|
374 | Specifies service ID.
|
375 |
|
376 | * `--env <service environment>`
|
377 |
|
378 | Specifies a service environment by ID or name.
|
379 |
|
380 | * `flex delete`
|
381 |
|
382 | Deletes the current Flex service, including all service environments inside it. The current service is the one you initiated last on the current profile. To delete a different service, specify its service ID. You will be prompted for confirmation unless you set the `--no-prompt` flag.
|
383 |
|
384 | * `--service <service>`
|
385 |
|
386 | Specifies service ID.
|
387 |
|
388 | * `--no-prompt`
|
389 |
|
390 | Do not ask for confirmation.
|
391 |
|
392 | * `flex clear`
|
393 |
|
394 | When executed in a Node.js project directory, this command removes the current Flex Service configuration from the project.
|
395 |
|
396 | * `help`
|
397 |
|
398 | Prints general usage instructions. For detailed command usage instruction, use the `--help` option with the command.
|
399 |
|
400 | ## Global Options
|
401 |
|
402 | You can add a global option to every Kinvey CLI command to get the described behavior. The only exceptions are `--email`, `--password`, `--instance-id` and `--2fa` which get ignored when added to a command that is designed to prompt for this information.
|
403 |
|
404 | * `--2fa <2fa-token>`
|
405 |
|
406 | Two-factor authentication token. Applicable when two-factor authentication is enabled.
|
407 |
|
408 | * `--email <e-mail>`
|
409 |
|
410 | Email address of your Kinvey account.
|
411 |
|
412 | * `--help, -h`
|
413 |
|
414 | When used after a `kinvey-cli` command, shows its usage instructions.
|
415 |
|
416 | * `--instance-id <instance ID>`
|
417 |
|
418 | ID (e.g., `kvy-us2`) or full hostname (e.g., `https://kvy-us2-manage.kinvey.com/`) of a Kinvey instance. It has a default value of `kvy-us1` (or `https://manage.kinvey.com/`) which most customers should use. If you are a customer on a dedicated Kinvey instance, enter your dedicated instance ID.
|
419 |
|
420 | * `--no-color`
|
421 |
|
422 | Disable colors.
|
423 |
|
424 | * `--output <format>`
|
425 |
|
426 | Output format. Valid choices: json.
|
427 |
|
428 | * `--password <password>`
|
429 |
|
430 | Password for your Kinvey account.
|
431 |
|
432 | * `--profile <profile>`
|
433 |
|
434 | Profile to use.
|
435 |
|
436 | * `--version`
|
437 |
|
438 | Prints the version number of `kinvey-cli`.
|
439 |
|
440 | * `--silent`
|
441 |
|
442 | Suppresses any output. Useful for scripting.
|
443 |
|
444 | * `--suppress-version-check`
|
445 |
|
446 | Prevents Kinvey CLI to check for new versions, which normally happens each execution.
|
447 |
|
448 | * `--verbose`
|
449 |
|
450 | Prints additional debug messages.
|
451 |
|
452 | ## Environment Variables
|
453 |
|
454 | Use environment variables to specify profile information for the `profile create` command when you don't want to specify it at the command line. Keep in mind that any values specified at the command line take precedence over the environment variable values.
|
455 |
|
456 | Command-specific options can also be specified as environment variables. You just need to prefix the name of the option with `KINVEY_CLI_`. For example, `--no-prompt` becomes `KINVEY_CLI_NO_PROMPT` as environment variable.
|
457 |
|
458 | * `KINVEY_CLI_EMAIL`
|
459 |
|
460 | Email address of your Kinvey account.
|
461 |
|
462 | * `KINVEY_CLI_PASSWORD`
|
463 |
|
464 | Password for your Kinvey account.
|
465 |
|
466 | * `KINVEY_CLI_INSTANCE_ID`
|
467 |
|
468 | ID (e.g., `kvy-us2`) or full hostname (e.g., `https://kvy-us2-manage.kinvey.com/`) of a Kinvey instance. It has a default value of `kvy-us1` (or `https://manage.kinvey.com/`) which most customers should use. If you are a customer on a dedicated Kinvey instance, enter your dedicated instance ID.
|
469 |
|
470 | * `KINVEY_CLI_2FA`
|
471 |
|
472 | Two-factor authentication token.
|
473 |
|
474 | * `KINVEY_CLI_PROFILE`
|
475 |
|
476 | Profile to use.
|
477 |
|
478 | Kinvey CLI also supports these universal environment variables:
|
479 |
|
480 | * `HTTPS_PROXY`/`https_proxy`
|
481 |
|
482 | Routes all Kinvey CLI requests through the specified proxy server.
|
483 |
|
484 |
|
485 | ## Getting Help
|
486 |
|
487 | Kinvey CLI comes with a two-stage help system. You can either call the `help` command to see an overview of the available commands or request details about a command usage with the `-h` flag.
|
488 |
|
489 | kinvey help
|
490 |
|
491 | kinvey flex -h
|
492 |
|
493 | kinvey flex logs -h
|
494 |
|
495 |
|
496 | ## Getting Started
|
497 |
|
498 | Kinvey CLI requires you to authenticate. The fastest way to get started is to run the `kinvey init` command. It prompts for credentials and hostname and creates a working profile for you, which stores the provided settings for future executions.
|
499 |
|
500 | Note that you only need to specify an instance ID if you are on a dedicated Kinvey instance. Otherwise just press Enter to continue.
|
501 |
|
502 | When prompted for `Profile name`, enter a name for your new working profile that Kinvey CLI will create for you. Kinvey CLI will use this profile automatically for future executions as long as it is the only profile on the system. You can create new profiles and select an active profile if you need to.
|
503 |
|
504 | ```
|
505 | $ kinvey init
|
506 | ? E-mail john.doe@kinvey.com
|
507 | ? Password ***********
|
508 | ? Instance ID (optional) kvy-us1
|
509 | ? Profile name dev
|
510 | ```
|
511 |
|
512 | You can run `kinvey init` from any directory as it always writes your new profile in your home directory.
|
513 |
|
514 | Next, you need to configure Kinvey CLI to connect to a Flex Service that you've already created using the Kinvey Console or through `kinvey flex create <service-name>`.
|
515 |
|
516 | For the following commands, you need to switch to the Node.js project directory that you will be deploying as a Flex Service as the configuration they create and read is project-specific.
|
517 |
|
518 | ```
|
519 | cd <node.js project dir>
|
520 | kinvey flex init
|
521 | ```
|
522 |
|
523 | Through a series of prompts, this command will ask you for a domain in which to operate (app or organization) and a Flex Service to deploy to.
|
524 |
|
525 | Finally, you are ready to deploy your Node.js project as a Flex Service.
|
526 |
|
527 | kinvey flex deploy
|
528 |
|
529 | Alongside the deploy you can set environment variables for your service. If both names and values are void of the equality sign (`=`) and comma (`,`), you can use the shorthand syntax:
|
530 |
|
531 | kinvey flex deploy --set-vars "MY_APP_A=valueA,MY_APP_B=valueB"
|
532 |
|
533 | Otherwise you need to specify environment variables in stringified JSON format:
|
534 |
|
535 | kinvey flex deploy --set-vars "{\"MY_APP_A\":[\"value 1\", \"value 2\"], \"MY_APP_B\":\"valueB\"}"
|
536 |
|
537 | **Note**: Kinvey CLI sends binary data (content type "multipart/form-data") during the deploy process. The deploy job will fail if traffic of this type is blocked within your network.
|
538 |
|
539 | ## Managing Profiles
|
540 |
|
541 | Another way to create working profiles, besides running `kinvey init`, is invoking `kinvey profile create <name>`. You can choose between providing the credentials at the command line or as preset [environment variables](#environment-variables).
|
542 |
|
543 | kinvey profile create dev --email john.doe@kinvey.com --password john'sPassword --instanceId kvy-us2
|
544 |
|
545 | You can create multiple profiles and specify which one to use at the command line.
|
546 |
|
547 | kinvey flex init --profile dev
|
548 |
|
549 | If you don't want to specify a profile every time, you can set one as active and it will be used for future executions:
|
550 |
|
551 | kinvey profile use dev
|
552 |
|
553 |
|
554 | **Note**: If you have a single profile, you can skip setting it as active as well as providing it as a command line option. It will be used if no other credentials are provided.
|
555 |
|
556 | ### Authentication Token Expiration
|
557 |
|
558 | As part of creating a working profile, the authentication token provided by Kinvey is stored locally. This token will be used to authenticate future command executions until it expires. At that point, you need to reenter your password or recreate the profile to keep working with Kinvey CLI. Run `kinvey profile login` to reenter your password. You can recreate the profile by providing the profile name to `kinvey init` or `kinvey profile create`.
|
559 |
|
560 | ## Authenticating One-time Commands
|
561 |
|
562 | Every command that requires authentication can take credentials and a hostname as command line options. If a hostname is not provided, its default value is used.
|
563 |
|
564 | kinvey flex status --service <service-id> --email <email> --password <password>
|
565 |
|
566 | You can also provide the same information through environment variables before running the command.
|
567 |
|
568 | **Linux, macOS**
|
569 | ```
|
570 | export KINVEY_CLI_EMAIL=<email>
|
571 | export KINVEY_CLI_PASSWORD=<password>
|
572 | export KINVEY_CLI_INSTANCE_ID=<instance ID>
|
573 | ```
|
574 |
|
575 | **Windows**
|
576 | ```
|
577 | set KINVEY_CLI_EMAIL=<email>
|
578 | set KINVEY_CLI_PASSWORD=<password>
|
579 | set KINVEY_CLI_INSTANCE_ID=<instance ID>
|
580 | ```
|
581 |
|
582 | ## Precedence of Configuration Options
|
583 |
|
584 | For the Kinvey CLI commands that require passing configuration values, the following precedence order applies.
|
585 |
|
586 | * Command line options—take precedence when specified
|
587 | * Environment variables—the first choice when command line arguments are missing
|
588 | * Profile data—values saved as part of the applicable working profile are used if neither command line arguments nor environment variables are set
|
589 |
|
590 |
|
591 | ## Output Format
|
592 |
|
593 | Kinvey CLI supports two output formats: plain text and JSON. Both are printed on the screen unless you redirect the output using shell syntax.
|
594 |
|
595 | Plain text is printed by default. Depending on the command, it produces tabular data or a simple message stating that the action has completed successfully.
|
596 |
|
597 | The JSON output format is suitable for cases where the output must be handled programmatically. It could be further processed using a tool like jq (command-line JSON processor). You can run any command with `--output json`. The output will then have the following format:
|
598 |
|
599 | ```
|
600 | {
|
601 | "result": [result]
|
602 | }
|
603 | ```
|
604 |
|
605 | ## Flex Runtime Version Selection
|
606 |
|
607 | Flex projects that you deploy run server-side on the Flex Runtime which represents a preconfigured Node.js environment. When creating a project and later when running it, you can select a Node.js version for the project to run on using the `--runtime` option.
|
608 |
|
609 | The runtime selection is limited to the major Node.js version. You can choose to run your project on the 6.x, 8.x, or 10.x branch but the minor and patch versions are always determined by the Flex Runtime.
|
610 |
|
611 | Kinvey makes its best to provide the [latest LTS](https://github.com/nodejs/Release#release-schedule) versions of the 6.x, 8.x, and 10.x branches. The frequent updates mean that the version that you start developing on may be replaced by the time you are ready to deploy the final version of your project.
|
612 |
|
613 | After you deploy a Flex project, it remains on the same Node.js version until you upgrade it to a new major version or Kinvey decides to upgrade the project's runtime to a more recent minor and patch version because of security or efficiency reasons.
|
614 |
|
615 | ## Proxy Settings
|
616 |
|
617 | Kinvey CLI supports the universal environment variables `HTTPS_PROXY` and `https_proxy` for routing commands through a proxy server. Set it if you are using a proxy.
|
618 |
|
619 |
|
620 | export HTTPS_PROXY=proxy.local
|
621 |
|
622 |
|
623 | ## Troubleshooting
|
624 |
|
625 | Run any command with the `--verbose` flag to receive more detailed information about a command execution.
|
626 |
|
627 | ### Caveats
|
628 |
|
629 | Kinvey CLI is a subject to the following caveats:
|
630 |
|
631 | - The CLI has a 10-second request timeout when communicating with the backend for initialization which may cause a connection error in some rare cases. Retrying the command remedies the problem in many cases.
|
632 | - If you are using a profile that has been configured a while ago, you may stumble upon the `InvalidCredentials` error. It may mean that the session token has expired. See [Authentication Token Expiration](#authentication-token-expiration) for details.
|
633 | - You cannot deploy the same service version to the FlexService Runtime more than once. You must increment the version in `package.json` before redeploying.
|
634 | - Kinvey CLI sends binary data (content type "multipart/form-data") during the deploy process. The deploy job will fail if traffic of this type is blocked within your network.
|
635 | - There is a limit of 100 MB to the size of the FlexService logs that are kept on the backend. When log entries exceed that size, the oldest ones are deleted.
|
636 | - Running the CLI from Git Bash on Windows is known to cause issues ranging from failing commands to complete inability to start. Use Windows Command Prompt instead.
|
637 |
|
638 | If problems persist, contact [Kinvey](http://support.kinvey.com).
|
639 |
|
640 | ### Support for Service Environments
|
641 |
|
642 | Kinvey CLI version 4.1.0 introduces support for environments inside Flex services coinciding with the release of this feature on the backend. When upgrading from a previous Kinvey CLI version, have the following caveats in mind:
|
643 |
|
644 | - The `flex init` interactive command prompts for service environment selection in version 4.1.0 and later if the service contains multiple environments.
|
645 | - Node.js projects configured with `flex init` with a Kinvey CLI version predating 4.1.0 do not contain a service environment ID. Therefore:
|
646 | - We recommend rerunning the `flex init` command on these projects.
|
647 | - Flex commands targeting the current service will continue to work as long as the service has a single environment.
|
648 | - Flex commands targeting the current service will error out if you create additional environments inside the service and don't include `--env`.
|
649 | - Flex commands specifying a particular service using `--service` must include `--env` if the service has multiple environments. You can omit `--env` if the service has a single environment.
|
650 |
|
651 | ## Changelog
|
652 |
|
653 | See the [Changelog](./CHANGELOG.md) for a list of changes.
|
654 |
|
655 | ## License
|
656 |
|
657 | Copyright (c) 2018, Kinvey, Inc. All rights reserved.
|
658 |
|
659 | This software is licensed to you under the Kinvey terms of service located at
|
660 | http://www.kinvey.com/terms-of-use. By downloading, accessing and/or using this
|
661 | software, you hereby accept such terms of service (and any agreement referenced
|
662 | therein) and agree that you have read, understand and agree to be bound by such
|
663 | terms of service and are of legal age to agree to such terms with Kinvey.
|
664 |
|
665 | This software contains valuable confidential and proprietary information of
|
666 | KINVEY, INC and is subject to applicable licensing agreements.
|
667 | Unauthorized reproduction, transmission or distribution of this file and its
|
668 | contents is a violation of applicable laws.
|