mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-04-07 11:26:41 +00:00
Added a --device-api-key
option to the config generate
command.
Change-Type: minor
This commit is contained in:
parent
2ef56a9a3f
commit
97eaf174ec
@ -194,9 +194,14 @@ exports.reconfigure = {
|
||||
exports.generate = {
|
||||
signature: 'config generate',
|
||||
description: 'generate a config.json file',
|
||||
help: 'Use this command to generate a config.json for a device or application\n\nExamples:\n\n $ resin config generate --device 7cf02a6\n $ resin config generate --device 7cf02a6 --output config.json\n $ resin config generate --app MyApp\n $ resin config generate --app MyApp --output config.json',
|
||||
help: 'Use this command to generate a config.json for a device or application\n\nExamples:\n\n $ resin config generate --device 7cf02a6\n $ resin config generate --device 7cf02a6 --device-api-key <existingDeviceKey>\n $ resin config generate --device 7cf02a6 --output config.json\n $ resin config generate --app MyApp\n $ resin config generate --app MyApp --output config.json',
|
||||
options: [
|
||||
commandOptions.optionalApplication, commandOptions.optionalDevice, {
|
||||
signature: 'deviceApiKey',
|
||||
description: 'custom device key',
|
||||
parameter: 'device-api-key',
|
||||
alias: 'k'
|
||||
}, {
|
||||
signature: 'output',
|
||||
description: 'output',
|
||||
parameter: 'output',
|
||||
@ -223,8 +228,11 @@ exports.generate = {
|
||||
return resin.models.application.get(options.application);
|
||||
}).then(function(resource) {
|
||||
return resin.models.device.getManifestBySlug(resource.device_type).get('options').then(form.run).then(function(answers) {
|
||||
var ref;
|
||||
if (resource.uuid != null) {
|
||||
return deviceConfig.getByDevice(resource.uuid, answers);
|
||||
return Promise.resolve((ref = options.deviceApiKey) != null ? ref : resin.models.device.generateDeviceKey(resource.uuid)).then(function(deviceApiKey) {
|
||||
return deviceConfig.getByDevice(resource.uuid, deviceApiKey, answers);
|
||||
});
|
||||
}
|
||||
return deviceConfig.getByApplication(resource.app_name, answers);
|
||||
});
|
||||
|
@ -1038,6 +1038,7 @@ Use this command to generate a config.json for a device or application
|
||||
Examples:
|
||||
|
||||
$ resin config generate --device 7cf02a6
|
||||
$ resin config generate --device 7cf02a6 --device-api-key <existingDeviceKey>
|
||||
$ resin config generate --device 7cf02a6 --output config.json
|
||||
$ resin config generate --app MyApp
|
||||
$ resin config generate --app MyApp --output config.json
|
||||
@ -1052,6 +1053,10 @@ application name
|
||||
|
||||
device uuid
|
||||
|
||||
#### --deviceApiKey, -k <device-api-key>
|
||||
|
||||
custom device key
|
||||
|
||||
#### --output, -o <output>
|
||||
|
||||
output
|
||||
|
@ -224,6 +224,7 @@ exports.generate =
|
||||
Examples:
|
||||
|
||||
$ resin config generate --device 7cf02a6
|
||||
$ resin config generate --device 7cf02a6 --device-api-key <existingDeviceKey>
|
||||
$ resin config generate --device 7cf02a6 --output config.json
|
||||
$ resin config generate --app MyApp
|
||||
$ resin config generate --app MyApp --output config.json
|
||||
@ -231,6 +232,12 @@ exports.generate =
|
||||
options: [
|
||||
commandOptions.optionalApplication
|
||||
commandOptions.optionalDevice
|
||||
{
|
||||
signature: 'deviceApiKey'
|
||||
description: 'custom device key'
|
||||
parameter: 'device-api-key'
|
||||
alias: 'k'
|
||||
}
|
||||
{
|
||||
signature: 'output'
|
||||
description: 'output'
|
||||
@ -267,7 +274,9 @@ exports.generate =
|
||||
.then(form.run)
|
||||
.then (answers) ->
|
||||
if resource.uuid?
|
||||
return deviceConfig.getByDevice(resource.uuid, answers)
|
||||
return Promise.resolve(options.deviceApiKey ? resin.models.device.generateDeviceKey(resource.uuid))
|
||||
.then (deviceApiKey) ->
|
||||
deviceConfig.getByDevice(resource.uuid, deviceApiKey, answers)
|
||||
return deviceConfig.getByApplication(resource.app_name, answers)
|
||||
.then (config) ->
|
||||
if options.output?
|
||||
|
@ -81,7 +81,7 @@
|
||||
"resin-cli-visuals": "^1.4.0",
|
||||
"resin-config-json": "^1.0.0",
|
||||
"resin-device-config": "^3.0.0",
|
||||
"resin-device-init": "^2.2.1",
|
||||
"resin-device-init": "^3.0.0",
|
||||
"resin-docker-build": "^0.4.0",
|
||||
"resin-doodles": "0.0.1",
|
||||
"resin-image-fs": "^2.3.0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user