Skip to content
Snippets Groups Projects
Commit b3f2844e authored by Xiao Gui's avatar Xiao Gui
Browse files

chore: improve logging, include visitor logging

parent 357697da
No related branches found
No related tags found
No related merge requests found
......@@ -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
*/
......
......@@ -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)
......
......@@ -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'
......
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