diff --git a/deploy/app.js b/deploy/app.js index e2260239c9dc507b9079e7a510b2750c20c5d27d..f233a07c66eefbc560bac96d259524d450f4c7b6 100644 --- a/deploy/app.js +++ b/deploy/app.js @@ -10,6 +10,19 @@ if (process.env.NODE_ENV !== 'production') { app.use(require('cors')()) } +app.use((req, _, next) => { + if (/main\.bundle\.js$/.test(req.originalUrl)){ + const xForwardedFor = req.headers['x-forwarded-for'] + const ip = req.connection.remoteAddress + console.log({ + type: 'visitorLog', + xForwardedFor, + ip + }) + } + next() +}) + /** * load env first, then load other modules */ diff --git a/deploy/auth/index.js b/deploy/auth/index.js index bfd8fab1724d4a1f052734684b2440baa1374e79..8c3895710418e81e78ef7aa5aea483013a799886 100644 --- a/deploy/auth/index.js +++ b/deploy/auth/index.js @@ -14,10 +14,8 @@ module.exports = async (app) => { passport.deserializeUser((id, done) => { const user = objStoreDb.get(id) - if (user) - return done(null, user) - else - return done(null, false) + if (user) return done(null, user) + else return done(null, false) }) await hbpOidc(app) diff --git a/deploy/server.js b/deploy/server.js index 9ac7a55d64aad602e5a46fcca38f0ebc98d979e9..4256b418128deae6033e4f2bfe29aa94a6c33008 100644 --- a/deploy/server.js +++ b/deploy/server.js @@ -9,7 +9,7 @@ if (process.env.FLUENT_HOST) { const Logger = require('./logging') const name = process.env.IAV_NAME || 'IAV' - const stage = process.env.IAV_STAGE || 'dev' + const stage = process.env.IAV_STAGE || 'unnamed-stage' const protocol = process.env.FLUENT_PROTOCOL || 'http' const host = process.env.FLUENT_HOST || 'localhost'