Add apps.upstreamUri support

This commit is contained in:
Johannes Zellner
2022-06-08 11:21:09 +02:00
parent a955457ee7
commit 6a7379e64c
5 changed files with 49 additions and 3 deletions

View File

@@ -37,6 +37,7 @@ exports = module.exports = {
setLocation,
setStorage,
setMounts,
setUpstreamUri,
stop,
start,
@@ -898,6 +899,18 @@ async function setMounts(req, res, next) {
next(new HttpSuccess(202, { taskId: result.taskId }));
}
async function setUpstreamUri(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
assert.strictEqual(typeof req.app, 'object');
if (typeof req.body.upstreamUri !== 'string') return next(new HttpError(400, 'upstreamUri must be a string'));
const [error] = await safe(apps.setUpstreamUri(req.app, req.body.upstreamUri, AuditSource.fromRequest(req)));
if (error) return next(BoxError.toHttpError(error));
next(new HttpSuccess(200, {}));
}
async function listEventlog(req, res, next) {
assert.strictEqual(typeof req.app, 'object');