rename addons.js to services.js

services is the named container (services view)
addons is more like a heroku concept
This commit is contained in:
Girish Ramakrishnan
2021-01-21 11:31:35 -08:00
parent d5952fafc3
commit 6bd87485c6
11 changed files with 75 additions and 75 deletions

View File

@@ -9,16 +9,16 @@ exports = module.exports = {
restart
};
var addons = require('../addons.js'),
assert = require('assert'),
const assert = require('assert'),
BoxError = require('../boxerror.js'),
HttpError = require('connect-lastmile').HttpError,
HttpSuccess = require('connect-lastmile').HttpSuccess;
HttpSuccess = require('connect-lastmile').HttpSuccess,
services = require('../services.js');
function getAll(req, res, next) {
req.clearTimeout(); // can take a while to get status of all services
addons.getServices(function (error, result) {
services.getServices(function (error, result) {
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, { services: result }));
@@ -28,7 +28,7 @@ function getAll(req, res, next) {
function get(req, res, next) {
assert.strictEqual(typeof req.params.service, 'string');
addons.getService(req.params.service, function (error, result) {
services.getService(req.params.service, function (error, result) {
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, { service: result }));
@@ -49,7 +49,7 @@ function configure(req, res, next) {
data.requireAdmin = req.body.requireAdmin;
}
addons.configureService(req.params.service, data, function (error) {
services.configureService(req.params.service, data, function (error) {
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(202, {}));
@@ -68,7 +68,7 @@ function getLogs(req, res, next) {
format: req.query.format || 'json'
};
addons.getServiceLogs(req.params.service, options, function (error, logStream) {
services.getServiceLogs(req.params.service, options, function (error, logStream) {
if (error) return next(BoxError.toHttpError(error));
res.writeHead(200, {
@@ -98,7 +98,7 @@ function getLogStream(req, res, next) {
format: 'json'
};
addons.getServiceLogs(req.params.service, options, function (error, logStream) {
services.getServiceLogs(req.params.service, options, function (error, logStream) {
if (error) return next(BoxError.toHttpError(error));
res.writeHead(200, {
@@ -122,7 +122,7 @@ function getLogStream(req, res, next) {
function restart(req, res, next) {
assert.strictEqual(typeof req.params.service, 'string');
addons.restartService(req.params.service, function (error) {
services.restartService(req.params.service, function (error) {
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(202, {}));