mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-04-08 11:54:12 +00:00
Auto-merge for PR #921 via VersionBot
Add --generate-device-api-key parameter to config generate
This commit is contained in:
commit
10a9840b34
@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file
|
||||
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## v7.7.0 - 2018-07-11
|
||||
|
||||
* Add --generate-device-api-key parameter to config generate #921 [Tim Perry]
|
||||
|
||||
## v7.6.2 - 2018-06-28
|
||||
|
||||
* Make local commands more resilient to unnamed containers #910 [Tim Perry]
|
||||
|
@ -1136,6 +1136,7 @@ that will be asked for the relevant device type.
|
||||
Examples:
|
||||
|
||||
$ resin config generate --device 7cf02a6
|
||||
$ resin config generate --device 7cf02a6 --generate-device-api-key
|
||||
$ resin config generate --device 7cf02a6 --device-api-key <existingDeviceKey>
|
||||
$ resin config generate --device 7cf02a6 --output config.json
|
||||
$ resin config generate --app MyApp
|
||||
@ -1156,6 +1157,10 @@ device uuid
|
||||
|
||||
custom device key - note that this is only supported on ResinOS 2.0.3+
|
||||
|
||||
#### --generate-device-api-key
|
||||
|
||||
generate a fresh device key for the device
|
||||
|
||||
#### --output, -o <output>
|
||||
|
||||
output
|
||||
|
@ -230,6 +230,7 @@ exports.generate =
|
||||
Examples:
|
||||
|
||||
$ resin config generate --device 7cf02a6
|
||||
$ resin config generate --device 7cf02a6 --generate-device-api-key
|
||||
$ resin config generate --device 7cf02a6 --device-api-key <existingDeviceKey>
|
||||
$ resin config generate --device 7cf02a6 --output config.json
|
||||
$ resin config generate --app MyApp
|
||||
@ -240,6 +241,11 @@ exports.generate =
|
||||
commandOptions.optionalApplication
|
||||
commandOptions.optionalDevice
|
||||
commandOptions.optionalDeviceApiKey
|
||||
{
|
||||
signature: 'generate-device-api-key'
|
||||
description: 'generate a fresh device key for the device'
|
||||
boolean: true
|
||||
}
|
||||
{
|
||||
signature: 'output'
|
||||
description: 'output'
|
||||
@ -303,7 +309,7 @@ exports.generate =
|
||||
form.run(formOptions, override: options)
|
||||
.then (answers) ->
|
||||
if resource.uuid?
|
||||
generateDeviceConfig(resource, options.deviceApiKey, answers)
|
||||
generateDeviceConfig(resource, options.deviceApiKey || options['generate-device-api-key'], answers)
|
||||
else
|
||||
generateApplicationConfig(resource, answers)
|
||||
.then (config) ->
|
||||
|
@ -75,7 +75,7 @@ export function generateApplicationConfig(
|
||||
|
||||
export function generateDeviceConfig(
|
||||
device: ResinSdk.Device & { application_name: string },
|
||||
deviceApiKey: string | null,
|
||||
deviceApiKey: string | true | null,
|
||||
options: {},
|
||||
) {
|
||||
return resin.models.application
|
||||
@ -111,9 +111,17 @@ function addApplicationKey(config: any, applicationNameOrId: string | number) {
|
||||
});
|
||||
}
|
||||
|
||||
function addDeviceKey(config: any, uuid: string, customDeviceApiKey: string) {
|
||||
function addDeviceKey(
|
||||
config: any,
|
||||
uuid: string,
|
||||
customDeviceApiKey: string | true,
|
||||
) {
|
||||
return Promise.try(() => {
|
||||
return customDeviceApiKey || resin.models.device.generateDeviceKey(uuid);
|
||||
if (customDeviceApiKey === true) {
|
||||
return resin.models.device.generateDeviceKey(uuid);
|
||||
} else {
|
||||
return customDeviceApiKey;
|
||||
}
|
||||
}).tap(deviceApiKey => {
|
||||
config.deviceApiKey = deviceApiKey;
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "resin-cli",
|
||||
"version": "7.6.2",
|
||||
"version": "7.7.0",
|
||||
"description": "The official resin.io CLI tool",
|
||||
"main": "./build/actions/index.js",
|
||||
"homepage": "https://github.com/resin-io/resin-cli",
|
||||
|
Loading…
x
Reference in New Issue
Block a user