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

22 lines
522 B
CoffeeScript
Raw Normal View History

2014-11-24 12:12:12 -04:00
Promise = require('bluebird')
canvas = require('./_canvas')
2014-11-26 12:38:02 -04:00
errors = require('../errors/errors')
2014-11-24 12:12:12 -04:00
exports.getAll = (applicationId) ->
return canvas.get
resource: 'environment_variable'
options:
filter:
application: applicationId
orderby: 'name asc'
2014-11-24 13:40:56 -04:00
.then (environmentVariables) ->
2014-11-24 12:12:12 -04:00
if not environmentVariables?
2014-11-24 14:48:16 -04:00
return Promise.reject(new errors.NotFound('environment variables'))
return environmentVariables
2014-11-24 13:00:36 -04:00
exports.remove = (id) ->
return canvas.delete
resource: 'environment_variable'
id: id