Skip to content
Snippets Groups Projects
Commit 32707d0d authored by FORESTIER Fabien's avatar FORESTIER Fabien
Browse files

Fixing import problems

parent 9870c16f
No related branches found
No related tags found
1 merge request!7Remodele this service
Pipeline #5043 passed
...@@ -4,6 +4,7 @@ const port = 9000; ...@@ -4,6 +4,7 @@ const port = 9000;
const httpProxy = require('http-proxy'); const httpProxy = require('http-proxy');
const cookieParser = require('cookie-parser'); const cookieParser = require('cookie-parser');
const printError = require('./helpers/logs.helpers.js').printError; const printError = require('./helpers/logs.helpers.js').printError;
const printLog = require('./helpers/logs.helpers.js').printLog;
// Parse the request headers in order to populate req.cookies // Parse the request headers in order to populate req.cookies
app.use(cookieParser()); app.use(cookieParser());
...@@ -44,7 +45,8 @@ const IGNProxy = httpProxy.createProxyServer({ ...@@ -44,7 +45,8 @@ const IGNProxy = httpProxy.createProxyServer({
if (req.socket.destroyed && err.code === 'ECONNRESET') { if (req.socket.destroyed && err.code === 'ECONNRESET') {
req._proxyReq.abort(); req._proxyReq.abort();
} }
return console.log(`ING proxy error, req.socket.destroyed: ${req.socket.destroyed}, ${err}`); printError(`ING proxy error, req.socket.destroyed: ${req.socket.destroyed}, ${err}`);
return;
}); });
const AuthenticatedProxy = httpProxy.createProxyServer({ const AuthenticatedProxy = httpProxy.createProxyServer({
...@@ -59,7 +61,8 @@ const AuthenticatedProxy = httpProxy.createProxyServer({ ...@@ -59,7 +61,8 @@ const AuthenticatedProxy = httpProxy.createProxyServer({
if (req.socket.destroyed && err.code === 'ECONNRESET') { if (req.socket.destroyed && err.code === 'ECONNRESET') {
req._proxyReq.abort(); req._proxyReq.abort();
} }
return printError(`Authenticated proxy error, req.socket.destroyed: ${req.socket.destroyed}, ${err}`); printError(`Authenticated proxy error, req.socket.destroyed: ${req.socket.destroyed}, ${err}`);
return;
}); });
var UnauthenticatedProxy = httpProxy.createProxyServer({ var UnauthenticatedProxy = httpProxy.createProxyServer({
...@@ -73,7 +76,8 @@ var UnauthenticatedProxy = httpProxy.createProxyServer({ ...@@ -73,7 +76,8 @@ var UnauthenticatedProxy = httpProxy.createProxyServer({
if (req.socket.destroyed && err.code === 'ECONNRESET') { if (req.socket.destroyed && err.code === 'ECONNRESET') {
req._proxyReq.abort(); req._proxyReq.abort();
} }
return printError(`Unauthenticated proxy Error, req.socket.destroyed: ${req.socket.destroyed}, ${err}`); printError(`Unauthenticated proxy Error, req.socket.destroyed: ${req.socket.destroyed}, ${err}`);
return;
}); });
app.locals.proxies = { app.locals.proxies = {
...@@ -86,4 +90,4 @@ app.locals.proxies = { ...@@ -86,4 +90,4 @@ app.locals.proxies = {
app.use(require('./routes/index.js')); app.use(require('./routes/index.js'));
// STARTING SERVER // STARTING SERVER
app.listen(port, () => printError(`Proxy listening on port: ${port}`)); app.listen(port, () => printLog('index.js', `Proxy listening on port: ${port}`));
\ No newline at end of file \ No newline at end of file
...@@ -2,6 +2,7 @@ const router = require('express').Router(); ...@@ -2,6 +2,7 @@ const router = require('express').Router();
const getRedisValue = require('../helpers/redis.helpers.js').getRedisValue; const getRedisValue = require('../helpers/redis.helpers.js').getRedisValue;
const setRedisValue = require('../helpers/redis.helpers.js').setRedisValue; const setRedisValue = require('../helpers/redis.helpers.js').setRedisValue;
const getDatasetInfoFromES = require('../helpers/elasticsearch.helpers.js').getDatasetInfoFromES; const getDatasetInfoFromES = require('../helpers/elasticsearch.helpers.js').getDatasetInfoFromES;
const printError = require('../helpers/logs.helpers.js').printError;
router.get('/ign', (req, res, next) => { router.get('/ign', (req, res, next) => {
req.headers['referer'] = 'grandlyon.com'; req.headers['referer'] = 'grandlyon.com';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment