File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -35,16 +35,18 @@ const addCheck = (check) => healthChecks.push(check);
35
35
const addReadinessCheck = ( check ) => readinessChecks . push ( check ) ;
36
36
const addMetrics = ( m ) => { metrics = m ; } ;
37
37
38
- const getMiddleware = ( ) => ( req , res , next ) => {
38
+ const getMiddleware = ( { debug = false } = { } ) => ( req , res , next ) => {
39
39
const requestingIP = req . ip || req . connection . remoteAddress
40
40
|| req . socket . remoteAddress || req . connection . socket . remoteAddress ;
41
41
42
42
// Only expect private IPs from this range
43
43
const ipVersion = net . isIPv6 ( requestingIP ) ? 'ipv6' : 'ipv4' ;
44
44
45
45
if ( ! blocklist . check ( requestingIP , ipVersion ) ) {
46
- // eslint-disable-next-line no-console
47
- console . debug ( `Blocking request from ${ requestingIP } ` ) ;
46
+ if ( debug ) {
47
+ // eslint-disable-next-line no-console
48
+ console . debug ( `Blocking request from ${ requestingIP } ` ) ;
49
+ }
48
50
49
51
return next ( ) ;
50
52
}
You can’t perform that action at this time.
0 commit comments