Skip to content

Commit

Permalink
Exempt /healthz from middleware
Browse files Browse the repository at this point in the history
Signed-off-by: Brett Logan <lindluni@github.com>
  • Loading branch information
lindluni committed Mar 13, 2024
1 parent ab831d5 commit 6fc3519
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import express from 'express'
import {limiter} from './src/limiter.js'
import {processWebhook, respond} from './src/routes.js'
import {unless} from './src/utils.js'
import {
debugRequest,
hydrateKey,
Expand All @@ -13,17 +14,18 @@ import {
} from './src/middleware.js'

const app = express()
app.use(unless('/healthz'), express.json())
app.use(unless('/healthz'), debugRequest)
app.use(unless('/healthz'), hydrateKey)
app.use(unless('/healthz'), limiter)
app.use(unless('/healthz'), verifyIsPR)
app.use(unless('/healthz'), verifyIssueCommentCreatedEvent)
app.use(unless('/healthz'), verifyGitHubWebhook)
app.use(unless('/healthz'), verifyMembership)
app.use(unless('/healthz'), verifyCommand)
app.use(unless('/healthz'), hydrateOctokit)

app.get('/healthz', respond)
app.use(express.json())
app.use(debugRequest)
app.use(hydrateKey)
app.use(limiter)
app.use(verifyIsPR)
app.use(verifyIssueCommentCreatedEvent)
app.use(verifyGitHubWebhook)
app.use(verifyMembership)
app.use(verifyCommand)
app.use(hydrateOctokit)
app.post('/api/github/webhooks', processWebhook)

const main = async () => {
Expand Down

0 comments on commit 6fc3519

Please sign in to comment.