Merge branch 'feature/del-privateIps' into 'master'
去掉ip 限制 去掉ip 限制 See merge request !107
Showing
1 changed file
with
12 additions
and
10 deletions
@@ -2,16 +2,18 @@ const _ = require('lodash'); | @@ -2,16 +2,18 @@ const _ = require('lodash'); | ||
2 | const logger = global.yoho.logger; | 2 | const logger = global.yoho.logger; |
3 | 3 | ||
4 | module.exports = (req, res, next) => { | 4 | module.exports = (req, res, next) => { |
5 | - try { | ||
6 | - const privateIps = _.get(req, 'app.locals.yap.json.privateips', []); | 5 | + try { |
6 | + const privateIps = _.get(req, 'app.locals.yap.json.privateips', []); | ||
7 | 7 | ||
8 | - if (_.includes(privateIps, req.yoho.clientIp) || _.get(req, 'app.locals.devEnv', false ) || | ||
9 | - _.get(req, 'app.locals.isTest', false)) { | ||
10 | - return next(); | ||
11 | - } | ||
12 | - } catch (error) { | ||
13 | - logger.error('[privateips error], ', error); | 8 | + logger.info(`privateIps: ${privateIps.join(',')}`); |
9 | + if (_.includes(privateIps, req.yoho.clientIp) || _.get(req, 'app.locals.devEnv', false) || | ||
10 | + _.get(req, 'app.locals.isTest', false)) { | ||
11 | + return next(); | ||
14 | } | 12 | } |
15 | - logger.warn(`[privateips warn], ${req.yoho.clientIp}`); | ||
16 | - return res.status(401).end(); | 13 | + } catch (error) { |
14 | + logger.error('[privateips error], ', error); | ||
15 | + } | ||
16 | + | ||
17 | + logger.warn(`[privateips warn], ${req.yoho.clientIp}`); | ||
18 | + return next(); | ||
17 | }; | 19 | }; |
-
Please register or login to post a comment