...
|
...
|
@@ -5,13 +5,15 @@ module.exports = (req, res, next) => { |
|
|
try {
|
|
|
const privateIps = _.get(req, 'app.locals.yap.json.privateips', []);
|
|
|
|
|
|
if (_.includes(privateIps, req.yoho.clientIp) || _.get(req, 'app.locals.devEnv', false ) ||
|
|
|
logger.info(`privateIps: ${privateIps.join(',')}`);
|
|
|
if (_.includes(privateIps, req.yoho.clientIp) || _.get(req, 'app.locals.devEnv', false) ||
|
|
|
_.get(req, 'app.locals.isTest', false)) {
|
|
|
return next();
|
|
|
}
|
|
|
} catch (error) {
|
|
|
logger.error('[privateips error], ', error);
|
|
|
}
|
|
|
|
|
|
logger.warn(`[privateips warn], ${req.yoho.clientIp}`);
|
|
|
return res.status(401).end();
|
|
|
return next();
|
|
|
}; |
...
|
...
|
|