mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-04-26 05:49:54 +00:00
Add preload --add-certificate option
Change-type: minor
This commit is contained in:
parent
e36435bb4c
commit
f3ef7f6e18
@ -183,6 +183,16 @@ module.exports =
|
|||||||
description: 'Pin the preloaded device (not application) to the preloaded release on provision'
|
description: 'Pin the preloaded device (not application) to the preloaded release on provision'
|
||||||
alias: 'p'
|
alias: 'p'
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
signature: 'add-certificate'
|
||||||
|
parameter: 'certificate.crt'
|
||||||
|
description: '''
|
||||||
|
Add the given certificate (in PEM format) to /etc/ssl/certs in the preloading container.
|
||||||
|
The file name must end with '.crt' and must not be already contained in the preloader's
|
||||||
|
/etc/ssl/certs folder.
|
||||||
|
Can be repeated to add multiple certificates.
|
||||||
|
'''
|
||||||
|
}
|
||||||
]
|
]
|
||||||
action: (params, options, done) ->
|
action: (params, options, done) ->
|
||||||
_ = require('lodash')
|
_ = require('lodash')
|
||||||
@ -229,6 +239,16 @@ module.exports =
|
|||||||
options.pinDevice = options['pin-device-to-release'] || false
|
options.pinDevice = options['pin-device-to-release'] || false
|
||||||
delete options['pin-device-to-release']
|
delete options['pin-device-to-release']
|
||||||
|
|
||||||
|
if _.isArray(options['add-certificate'])
|
||||||
|
certificates = options['add-certificate']
|
||||||
|
else if options['add-certificate'] == undefined
|
||||||
|
certificates = []
|
||||||
|
else
|
||||||
|
certificates = [ options['add-certificate'] ]
|
||||||
|
for certificate in certificates
|
||||||
|
if not certificate.endsWith('.crt')
|
||||||
|
exitWithExpectedError('Certificate file name must end with ".crt"')
|
||||||
|
|
||||||
# Get a configured dockerode instance
|
# Get a configured dockerode instance
|
||||||
dockerUtils.getDocker(options)
|
dockerUtils.getDocker(options)
|
||||||
.then (docker) ->
|
.then (docker) ->
|
||||||
@ -243,6 +263,7 @@ module.exports =
|
|||||||
options.proxy
|
options.proxy
|
||||||
options.dontCheckArch
|
options.dontCheckArch
|
||||||
options.pinDevice
|
options.pinDevice
|
||||||
|
certificates
|
||||||
)
|
)
|
||||||
|
|
||||||
gotSignal = false
|
gotSignal = false
|
||||||
|
@ -112,7 +112,7 @@
|
|||||||
"balena-config-json": "^2.0.0",
|
"balena-config-json": "^2.0.0",
|
||||||
"balena-device-init": "^5.0.0",
|
"balena-device-init": "^5.0.0",
|
||||||
"balena-image-manager": "^6.0.0",
|
"balena-image-manager": "^6.0.0",
|
||||||
"balena-preload": "^8.1.4",
|
"balena-preload": "^8.2.0",
|
||||||
"balena-sdk": "^11.17.0",
|
"balena-sdk": "^11.17.0",
|
||||||
"balena-settings-client": "^4.0.0",
|
"balena-settings-client": "^4.0.0",
|
||||||
"balena-sync": "^10.0.3",
|
"balena-sync": "^10.0.3",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user