mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-19 13:47:52 +00:00
Implement env rename command
This commit is contained in:
parent
de4c3c986e
commit
eb34d957f3
@ -39,3 +39,7 @@ exports.add = permissions.user (params, options) ->
|
||||
|
||||
resin.models.environmentVariables.create options.application, params.key, params.value, (error) ->
|
||||
resin.errors.handle(error) if error?
|
||||
|
||||
exports.rename = permissions.user (params, options) ->
|
||||
resin.models.environmentVariables.update params.id, params.value, (error) ->
|
||||
resin.errors.handle(error) if error?
|
||||
|
@ -363,6 +363,17 @@ capitano.command
|
||||
options: [ applicationOption ]
|
||||
action: actions.env.add
|
||||
|
||||
capitano.command
|
||||
signature: 'env rename <id> <value>'
|
||||
description: 'rename an environment variable'
|
||||
help: '''
|
||||
Use this command to rename an enviroment variable from an application.
|
||||
|
||||
Examples:
|
||||
$ resin env rename 376 emacs
|
||||
'''
|
||||
action: actions.env.rename
|
||||
|
||||
capitano.command
|
||||
signature: 'env rm <id>'
|
||||
description: 'remove an environment variable'
|
||||
|
@ -55,6 +55,29 @@ exports.create = (applicationId, name, value, callback) ->
|
||||
.catch (error) ->
|
||||
return callback(error)
|
||||
|
||||
# Update an environment variable value from an application
|
||||
#
|
||||
# @param {String, Number} applicationId application id
|
||||
# @param {String} value environment variable value
|
||||
# @param {Function} callback callback(error)
|
||||
#
|
||||
# @example Update an environment variable
|
||||
# resin.models.environmentVariables.update 317, 'vim', (error) ->
|
||||
# throw error if error?
|
||||
#
|
||||
exports.update = (id, value, callback) ->
|
||||
return pine.patch
|
||||
resource: 'environment_variable'
|
||||
id: id
|
||||
data:
|
||||
value: value
|
||||
|
||||
.then ->
|
||||
return callback()
|
||||
|
||||
.catch (error) ->
|
||||
return callback(error)
|
||||
|
||||
# Remove environment variable
|
||||
#
|
||||
# @param {String, Number} id environment variable id
|
||||
|
Loading…
Reference in New Issue
Block a user