Define webhook URL
This commit is contained in:
parent
0079901311
commit
c976f7b53f
3 changed files with 19 additions and 1 deletions
|
@ -254,6 +254,23 @@ func declareAPIAuthRepositoriesRoutes(router *gin.RouterGroup) {
|
|||
})
|
||||
}
|
||||
|
||||
func declareCallbacksRoutes(router *gin.RouterGroup) {
|
||||
router.POST("/callbacks/trigger.json", func(c *gin.Context) {
|
||||
log.Println("Received trigger")
|
||||
log.Println("X-Gitlab-Token", c.Request.Header.Get("X-Gitlab-Token"))
|
||||
|
||||
tmp := map[string]interface{}{}
|
||||
if err := c.ShouldBindJSON(&tmp); err != nil {
|
||||
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"errmsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
log.Println("Content", tmp)
|
||||
|
||||
c.JSON(http.StatusOK, true)
|
||||
})
|
||||
}
|
||||
|
||||
func repositoryHandler(c *gin.Context) {
|
||||
var u *User
|
||||
if user, ok := c.Get("user"); ok {
|
||||
|
|
Reference in a new issue