Revert "more changes"

This reverts commit d69af56c90.
This commit is contained in:
Johannes Zellner
2020-10-28 16:16:10 +01:00
parent b525b6e4fa
commit 03e49c59e2
2 changed files with 5 additions and 11 deletions
+5 -10
View File
@@ -15,7 +15,7 @@ var addons = require('../addons.js'),
HttpError = require('connect-lastmile').HttpError,
HttpSuccess = require('connect-lastmile').HttpSuccess;
function getAll(req, next) {
function getAll(req, res, next) {
req.clearTimeout(); // can take a while to get status of all services
addons.getServices(function (error, result) {
@@ -25,7 +25,7 @@ function getAll(req, next) {
});
}
function get(req, next) {
function get(req, res, next) {
assert.strictEqual(typeof req.params.service, 'string');
addons.getService(req.params.service, function (error, result) {
@@ -35,7 +35,7 @@ function get(req, next) {
});
}
function configure(req, next) {
function configure(req, res, next) {
assert.strictEqual(typeof req.params.service, 'string');
if (typeof req.body.memory !== 'number') return next(new HttpError(400, 'memory must be a number'));
@@ -46,14 +46,9 @@ function configure(req, next) {
memorySwap: req.body.memorySwap
};
const [ name ] = req.params.service.split(':');
if (name === 'sftp' && 'requireAdmin' in req.body) {
if (req.params.service === 'sftp' && 'requireAdmin' in req.body) {
if (typeof req.body.requireAdmin !== 'boolean') return next(new HttpError(400, 'requireAdmin must be a boolean'));
data.requireAdmin = req.body.requireAdmin;
} else if (name === 'redis') {
if ('disabled' in req.body && typeof req.body.disabled !== 'boolean') return next(new HttpError(400, 'disabled must be a boolean'));
data.disabled = !!req.body.disabled;
}
addons.configureService(req.params.service, data, function (error) {
@@ -126,7 +121,7 @@ function getLogStream(req, res, next) {
});
}
function restart(req, next) {
function restart(req, res, next) {
assert.strictEqual(typeof req.params.service, 'string');
addons.restartService(req.params.service, function (error) {