-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AUD-417] Update UM mode for promotion (#1300)
* Disable UM route filtering
- Loading branch information
1 parent
e930753
commit 8356c0a
Showing
1 changed file
with
2 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,6 @@ | ||
const { sendResponse, errorResponseUnauthorized } = require('./apiHelpers') | ||
const config = require('./config') | ||
|
||
async function userNodeMiddleware (req, res, next) { | ||
const isUserMetadataNode = config.get('isUserMetadataNode') | ||
const userNodeRegex = new RegExp(/(users|version|db_check|health_check|image_upload|ipfs|export)/gm) | ||
if (isUserMetadataNode) { | ||
const isValidUrl = userNodeRegex.test(req.url) | ||
if (!isValidUrl) { | ||
return sendResponse(req, res, errorResponseUnauthorized('Invalid route for user metadata node')) | ||
} | ||
next() | ||
} else { | ||
next() | ||
} | ||
// Disable all UM specific filtering | ||
return next() | ||
} | ||
|
||
module.exports = { userNodeMiddleware } |