balena-cli/lib/resin/models/environment-variables.coffee

29 lines
642 B
CoffeeScript
Raw Normal View History

2014-11-24 16:12:12 +00:00
canvas = require('./_canvas')
2014-11-26 16:38:02 +00:00
errors = require('../errors/errors')
2014-11-24 16:12:12 +00:00
exports.getAll = (applicationId, callback) ->
2014-11-24 16:12:12 +00:00
return canvas.get
resource: 'environment_variable'
options:
filter:
application: applicationId
orderby: 'name asc'
2014-11-24 17:40:56 +00:00
.then (environmentVariables) ->
2014-11-24 16:12:12 +00:00
if not environmentVariables?
return callback(new errors.NotFound('environment variables'))
2014-11-24 17:00:36 +00:00
return callback(null, environmentVariables)
.catch (error) ->
return callback(error)
exports.remove = (id, callback) ->
2014-11-24 17:00:36 +00:00
return canvas.delete
resource: 'environment_variable'
id: id
.then ->
return callback()
.catch (error) ->
return callback(error)