mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-27 19:00:35 +00:00
18 lines
357 B
Go
18 lines
357 B
Go
|
package middleware
|
||
|
|
||
|
import (
|
||
|
"github.com/drone/drone/bus"
|
||
|
|
||
|
"github.com/codegangsta/cli"
|
||
|
"github.com/gin-gonic/gin"
|
||
|
)
|
||
|
|
||
|
// Bus is a middleware function that initializes the Event Bus and attaches to
|
||
|
// the context of every http.Request.
|
||
|
func Bus(cli *cli.Context) gin.HandlerFunc {
|
||
|
v := bus.New()
|
||
|
return func(c *gin.Context) {
|
||
|
bus.ToContext(c, v)
|
||
|
}
|
||
|
}
|