redis: make optional

part of #810
This commit is contained in:
Girish Ramakrishnan
2023-07-13 16:37:33 +05:30
parent f34840e1a3
commit 25328d884f
5 changed files with 51 additions and 5 deletions

View File

@@ -25,6 +25,7 @@ exports = module.exports = {
setTags,
setIcon,
setTurn,
setRedis,
setMemoryLimit,
setCpuShares,
setAutomaticBackup,
@@ -422,6 +423,18 @@ async function setTurn(req, res, next) {
next(new HttpSuccess(202, { taskId: result.taskId }));
}
async function setRedis(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
assert.strictEqual(typeof req.app, 'object');
if (typeof req.body.enable !== 'boolean') return next(new HttpError(400, 'enable must be a boolean'));
const [error, result] = await safe(apps.setRedis(req.app, req.body.enable, AuditSource.fromRequest(req)));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(202, { taskId: result.taskId }));
}
async function setLocation(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
assert.strictEqual(typeof req.app, 'object');