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'))
|
2014-11-24 16:43:37 +00:00
|
|
|
return environmentVariables
|
2014-11-24 17:00:36 +00:00
|
|
|
|
|
|
|
exports.remove = (id) ->
|
|
|
|
return canvas.delete
|
|
|
|
resource: 'environment_variable'
|
|
|
|
id: id
|