added ip filter

This commit is contained in:
Martin Donnelly 2018-06-13 22:50:57 +01:00
parent 0325a7cdd3
commit a2a71f7812
3 changed files with 315 additions and 267 deletions

573
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -12,6 +12,7 @@
"apicache": "^1.1.0",
"body-parser": "^1.18.2",
"express": "^4.16.1",
"express-ipfilter": "^0.3.1",
"http": "0.0.0",
"https": "^1.0.0",
"log4js": "^2.3.4",

View File

@ -11,6 +11,8 @@ const http = require('http');
const https = require('https');
const apicache = require('apicache');
const ipfilter = require('express-ipfilter').IpFilter;
const port = process.env.PORT || 8080;
logger.level = 'debug';
@ -24,9 +26,9 @@ const cache = apicache.middleware;
app.use(cache('15 minutes'));
const ips = [
// const ips = ['212.71.255.44', '82.35.75.161'];
];
const ips = ['212.71.255.44'];
const bouncer = ['phpmyadmin',
'phpMyadmin',
@ -192,6 +194,8 @@ app.get('*', function(req, res, next) {
next(err);
});
app.use(ipfilter(ips, { 'mode': 'allow' }));
const server = app.listen(port, () => {
logger.info(`Server listening on port ${port}`);
});