Skip to content

Commit

Permalink
chore(moesif): bump moesif-nodejs from 3.1.5 to 3.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
PauloGoncalvesBH committed Apr 11, 2024
1 parent 86aba7d commit 06db7fe
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 28 deletions.
26 changes: 9 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"express-validation": "^3.0.8",
"is-ci": "^3.0.0",
"jsonwebtoken": "^8.5.1",
"moesif-nodejs": "^3.1.5",
"moesif-nodejs": "^3.6.1",
"morgan": "^1.10.0",
"nedb-promises": "^5.0.0",
"open": "^8.0.6",
Expand Down
5 changes: 2 additions & 3 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const {
} = require('./utils/ambiente')
const { conf } = require('./utils/conf')
const errorHandler = require('./middlewares/error-handler')
const localMonitor = require('./utils/localMonitor')
const moesifMiddleware = require('./middlewares/moesif-monitor-middleware')
const { version } = require('../package.json')
const swaggerDocument = require('../docs/swagger.json')
const packageJson = require('../package.json')
Expand All @@ -47,6 +47,7 @@ app.use(express.urlencoded({ extended: false }))
app.use(queryParser())
app.use(timeout())
app.use(cors())
app.use(moesifMiddleware)

app.disable('etag')

Expand All @@ -71,8 +72,6 @@ if (aplicacaoExecutandoLocalmente() && !ehAmbienteDeTestes) {
app.use(require('express-status-monitor')({ title: 'ServeRest Status' }))
}

localMonitor(app)

const hostMapping = {
'serverest.dev': 'serverest.dev',
'staging.serverest.dev': 'staging.serverest.dev',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ const {
formaDeExecucao,
ehAmbienteDeDesenvolvimento,
ehAmbienteDeTestes
} = require('./ambiente')
} = require('../utils/ambiente')

module.exports = async app => {
if (ehAmbienteDeDesenvolvimento || ehAmbienteDeTestes || !aplicacaoExecutandoLocalmente()) {
return
function moesifMiddleware (req, res, next) {
if (ehAmbienteDeDesenvolvimento || ehAmbienteDeTestes || !aplicacaoExecutandoLocalmente() || !process.env.MOESIF_APPLICATION_ID) {
return next()
}
const { porta, timeout, nodoc, nobearer, nosec } = require('../server').argv
const urlsToSkip = [
Expand All @@ -34,8 +34,10 @@ module.exports = async app => {
'/swagger-ui-bundle.js',
'/swagger-ui-bundle.js.map'
]
const moesifMiddleware = moesif({

const options = {
applicationId: process.env.MOESIF_APPLICATION_ID,
logbody: true,
identifyUser: (req, res) => { return formaDeExecucao() },
identifyCompany: (req, res) => { return version },
skip: (req, res) => {
Expand All @@ -53,6 +55,10 @@ module.exports = async app => {
}
},
noAutoHideSensitive: true
})
app.use(moesifMiddleware)
}

moesif(options)
return next()
}

module.exports = moesifMiddleware

0 comments on commit 06db7fe

Please sign in to comment.