Documentation ¶
Overview ¶
Package middleware provides the ability for injecting Vela resources into the middleware chain for the API.
Usage:
import "github.com/go-vela/worker/router/middleware"
Index ¶
- func Executors(e map[int]executor.Engine) gin.HandlerFunc
- func Logger(logger *logrus.Logger, timeFormat string, utc bool) gin.HandlerFunc
- func NoCache(c *gin.Context)
- func Options(c *gin.Context)
- func Payload() gin.HandlerFunc
- func RegisterToken(r chan string) gin.HandlerFunc
- func RequestVersion(c *gin.Context)
- func ResponseVersion(c *gin.Context)
- func Secure(c *gin.Context)
- func ServerAddress(addr string) gin.HandlerFunc
- func WorkerHostname(name string) gin.HandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Executors ¶ added in v0.4.0
func Executors(e map[int]executor.Engine) gin.HandlerFunc
Executors is a middleware function that attaches the executors to the context of every http.Request.
func Logger ¶
Logger returns a gin.HandlerFunc (middleware) that logs requests using logrus.
Requests with errors are logged using logrus.Error(). Requests without errors are logged using logrus.Info().
It receives:
- A time package format string (e.g. time.RFC3339).
- A boolean stating whether to use UTC time zone or local.
func NoCache ¶
NoCache is a middleware function that appends headers to prevent the client from caching the HTTP response.
func Options ¶
Options is a middleware function that appends headers for options requests and aborts then exits the middleware chain and ends the request.
func Payload ¶
func Payload() gin.HandlerFunc
Payload is a middleware function that captures the user provided json body and attaches it to the context of every http.Request to be logged.
func RegisterToken ¶ added in v0.19.0
func RegisterToken(r chan string) gin.HandlerFunc
RegisterToken is a middleware function that attaches the auth-token channel to the context of every http.Request.
func RequestVersion ¶
RequestVersion is a middleware function that injects the Vela API version information into the request so it will be logged. This is intended for debugging and troubleshooting.
func ResponseVersion ¶
ResponseVersion is a middleware function that injects the Vela API version information into the response so it will be logged. This is intended for debugging and troubleshooting.
func ServerAddress ¶ added in v0.19.0
func ServerAddress(addr string) gin.HandlerFunc
ServerAddress is a middleware function that attaches the server address to the context of every http.Request.
func WorkerHostname ¶ added in v0.19.0
func WorkerHostname(name string) gin.HandlerFunc
WorkerHostname is a middleware function that attaches the worker hostname to the context of every http.Request.
Types ¶
This section is empty.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package perm provides the ability for inserting Vela user permissions resources into or extracting Vela user permissions resources from the middleware chain for the API.
|
Package perm provides the ability for inserting Vela user permissions resources into or extracting Vela user permissions resources from the middleware chain for the API. |
Package token provides the ability for inserting Vela token resources into or extracting Vela token resources from the middleware chain for the API.
|
Package token provides the ability for inserting Vela token resources into or extracting Vela token resources from the middleware chain for the API. |