22 lines
405 B
Go
22 lines
405 B
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"git.company.lan/gopkg/gin"
|
|
"git.company.lan/gopkg/gin-contrib/pprof"
|
|
)
|
|
|
|
func main() {
|
|
router := gin.Default()
|
|
adminGroup := router.Group("/admin", func(c *gin.Context) {
|
|
if c.Request.Header.Get("Authorization") != "foobar" {
|
|
c.AbortWithStatus(http.StatusForbidden)
|
|
return
|
|
}
|
|
c.Next()
|
|
})
|
|
pprof.RouteRegister(adminGroup, "pprof")
|
|
router.Run(":8080")
|
|
}
|