Skip to content
Snippets Groups Projects
Unverified Commit cfc8927f authored by xgui3783's avatar xgui3783 Committed by GitHub
Browse files

Merge pull request #280 from HumanBrainProject/feat/logging

chore: improve logging, include visitor logging
parents 357697da b3f2844e
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,19 @@ if (process.env.NODE_ENV !== 'production') { ...@@ -10,6 +10,19 @@ if (process.env.NODE_ENV !== 'production') {
app.use(require('cors')()) 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 * load env first, then load other modules
*/ */
......
...@@ -14,10 +14,8 @@ module.exports = async (app) => { ...@@ -14,10 +14,8 @@ module.exports = async (app) => {
passport.deserializeUser((id, done) => { passport.deserializeUser((id, done) => {
const user = objStoreDb.get(id) const user = objStoreDb.get(id)
if (user) if (user) return done(null, user)
return done(null, user) else return done(null, false)
else
return done(null, false)
}) })
await hbpOidc(app) await hbpOidc(app)
......
...@@ -9,7 +9,7 @@ if (process.env.FLUENT_HOST) { ...@@ -9,7 +9,7 @@ if (process.env.FLUENT_HOST) {
const Logger = require('./logging') const Logger = require('./logging')
const name = process.env.IAV_NAME || 'IAV' 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 protocol = process.env.FLUENT_PROTOCOL || 'http'
const host = process.env.FLUENT_HOST || 'localhost' const host = process.env.FLUENT_HOST || 'localhost'
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment