Skip to content

Commit 5c90cab

Browse files
authored
exclude health check from auth middleware (#53)
1 parent edacd7e commit 5c90cab

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

app/run.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ func SetupRouter(vs *verify.VerifySvc) *gin.Engine {
2121
panic("AUTH_HEADER_NAME and AUTH_HEADER_VALUE must be set")
2222
}
2323

24-
r.Use(func(c *gin.Context) {
24+
tppGroup := r.Group("/tpp")
25+
tppGroup.Use(func(c *gin.Context) {
2526
if c.GetHeader(headerName) != headerValue {
2627
c.AbortWithStatusJSON(http.StatusForbidden, gin.H{"error": "Invalid or missing header"})
2728
return
2829
}
2930
c.Next()
3031
})
31-
32-
r.POST("/tpp/verify", vs.Verify)
32+
tppGroup.POST("/verify", vs.Verify)
3333
r.GET("/health", func(c *gin.Context) {
3434
c.JSON(http.StatusOK, gin.H{"status": "ok"})
3535
})

0 commit comments

Comments
 (0)