2014-11-24 12:12:12 -04:00
|
|
|
canvas = require('./_canvas')
|
2014-11-26 12:38:02 -04:00
|
|
|
errors = require('../errors/errors')
|
2014-11-24 12:12:12 -04:00
|
|
|
|
2014-11-26 14:11:02 -04:00
|
|
|
exports.getAll = (applicationId, callback) ->
|
2014-11-24 12:12:12 -04:00
|
|
|
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-26 14:11:02 -04:00
|
|
|
return callback(new errors.NotFound('environment variables'))
|
2014-11-24 13:00:36 -04:00
|
|
|
|
2014-11-26 14:11:02 -04:00
|
|
|
return callback(null, environmentVariables)
|
|
|
|
|
|
|
|
.catch (error) ->
|
|
|
|
return callback(error)
|
|
|
|
|
|
|
|
exports.remove = (id, callback) ->
|
2014-11-24 13:00:36 -04:00
|
|
|
return canvas.delete
|
|
|
|
resource: 'environment_variable'
|
|
|
|
id: id
|
2014-11-26 14:11:02 -04:00
|
|
|
.then ->
|
|
|
|
return callback()
|
|
|
|
.catch (error) ->
|
|
|
|
return callback(error)
|