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

22 lines
522 B
CoffeeScript
Raw Normal View History

2014-11-24 16:12:12 +00:00
Promise = require('bluebird')
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) ->
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?
2014-11-24 18:48:16 +00:00
return Promise.reject(new errors.NotFound('environment variables'))
return environmentVariables
2014-11-24 17:00:36 +00:00
exports.remove = (id) ->
return canvas.delete
resource: 'environment_variable'
id: id