v2: fix switch case in test API (был сломан sed-ом)
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ipwhitelist",
|
"name": "ipwhitelist",
|
||||||
"version": "0.5.83",
|
"version": "0.5.84",
|
||||||
"description": "IP WhiteList microservice for cloud provider",
|
"description": "IP WhiteList microservice for cloud provider",
|
||||||
"main": "server.js",
|
"main": "server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// ═══════════════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
version: '0.5.83',
|
version: '0.5.84',
|
||||||
iamUrl: process.env.V2_IAM_API_URL || 'https://auth-api.ngcloud.ru',
|
iamUrl: process.env.V2_IAM_API_URL || 'https://auth-api.ngcloud.ru',
|
||||||
appUrl: process.env.V2_APP_URL || 'https://whitelist.nodejsk8s.services.ngcloud.ru',
|
appUrl: process.env.V2_APP_URL || 'https://whitelist.nodejsk8s.services.ngcloud.ru',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -61,6 +61,17 @@ function createTestRouter() {
|
|||||||
case 'limit':
|
case 'limit':
|
||||||
return res.json({ ok: true, limit: await q.getLimit(company) });
|
return res.json({ ok: true, limit: await q.getLimit(company) });
|
||||||
|
|
||||||
|
// ── SWITCH ──
|
||||||
|
case 'switch': {
|
||||||
|
const to = req.query.to;
|
||||||
|
if (!to) return res.json({ ok: false, error: 'no to parameter' });
|
||||||
|
if (!user.allClientIds.includes(to)) return res.json({ ok: false, error: 'not in allClientIds' });
|
||||||
|
user.activeClientId = to;
|
||||||
|
const p = user.profiles.find(p => p.client_id === to);
|
||||||
|
if (p) { p.is_active_profile = true; user.profiles.forEach(x => { if (x !== p) x.is_active_profile = false; }); }
|
||||||
|
return res.json({ ok: true, switchedTo: to });
|
||||||
|
}
|
||||||
|
|
||||||
// ── CLEANUP ──
|
// ── CLEANUP ──
|
||||||
case 'cleanup': {
|
case 'cleanup': {
|
||||||
const cids = (req.query.cids || '').split(',');
|
const cids = (req.query.cids || '').split(',');
|
||||||
|
|||||||
Reference in New Issue
Block a user