sftp: prefix the id with app- and volume-

this helps the backend identify the type of mount
This commit is contained in:
Girish Ramakrishnan
2021-09-25 23:27:25 -07:00
parent 8553b57982
commit d4edd771b5
3 changed files with 15 additions and 8 deletions

View File

@@ -1,7 +1,8 @@
'use strict';
exports = module.exports = {
proxy
proxyAppData,
proxyVolumeData
};
const assert = require('assert'),
@@ -12,10 +13,8 @@ const assert = require('assert'),
services = require('../services.js'),
url = require('url');
async function proxy(req, res, next) {
assert.strictEqual(typeof req.params.id, 'string');
const id = req.params.id; // app id or volume id
async function proxy(id, req, res, next) {
assert.strictEqual(typeof id, 'string');
req.clearTimeout();
@@ -40,3 +39,11 @@ async function proxy(req, res, next) {
next(new HttpError(500, error));
});
}
function proxyAppData(req, res, next) {
proxy(`app-${req.params.id}`, req, res, next);
}
function proxyVolumeData(req, res, next) {
proxy(`volume-${req.params.id}`, req, res, next);
}