Skip to content

Commit

Permalink
add application version of the deployed app to the health check endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
elrayle committed Apr 27, 2024
1 parent 5fff50a commit 562a5d4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function createApp(config) {

app.use(require('./middleware/querystring'))

app.use('/', require('./routes/index')(config.buildsha))
app.use('/', require('./routes/index')(config.buildsha, config.appversion))
app.use('/origins/github', require('./routes/originGitHub')())
app.use('/origins/crate', require('./routes/originCrate')())
app.use('/origins/conda', require('./routes/originConda')())
Expand Down
1 change: 1 addition & 0 deletions bin/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,6 @@ module.exports = {
crawlerId: config.get('APPINSIGHTS_CRAWLER_APPLICATIONID'),
crawlerKey: config.get('APPINSIGHTS_CRAWLER_APIKEY')
},
appversion: config.get('APP_VERSION'),
buildsha: config.get('BUILD_SHA')
}
6 changes: 4 additions & 2 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ const express = require('express')
const router = express.Router()

router.get('/', function (req, res) {
const msg = `{ "status": "OK", "sha": "${sha}" }`
const msg = `{ "status": "OK", "version": "${version}", "sha": "${sha}"`
res.status(200).send(msg)
})

module.exports = router

let version
let sha
function setup(buildsha) {
function setup(buildsha, appversion) {
version = appversion
sha = buildsha
return router
}
Expand Down

0 comments on commit 562a5d4

Please sign in to comment.