Merge pull request #122 from shocknet/bug/route-logging

Added a .env toggle for enabling/disabling detailed route logging
This commit is contained in:
CapDog 2020-07-27 17:34:33 -04:00 committed by GitHub
commit 99ba9be89b
2 changed files with 25 additions and 24 deletions

View file

@ -274,8 +274,6 @@ module.exports = async (
app.use(async (req, res, next) => { app.use(async (req, res, next) => {
try { try {
logger.info("Route:", req.path)
if (unprotectedRoutes[req.method][req.path]) { if (unprotectedRoutes[req.method][req.path]) {
next(); next();
return; return;

View file

@ -195,6 +195,7 @@ const server = program => {
}) })
app.use((req, res, next) => { app.use((req, res, next) => {
if (process.env.ROUTE_LOGGING === 'true') {
if (sensitiveRoutes[req.method][req.path]) { if (sensitiveRoutes[req.method][req.path]) {
logger.info( logger.info(
JSON.stringify({ JSON.stringify({
@ -218,8 +219,10 @@ const server = program => {
}) })
) )
} }
}
next() next()
}) })
app.use( app.use(
session({ session({
secret: defaults.sessionSecret, secret: defaults.sessionSecret,