Documentation ¶
Overview ¶
Package middleware provides the ability for injecting Vela resources into the middleware chain for the API.
Usage:
import "github.com/go-vela/server/router/middleware"
Index ¶
- func Compiler(cli compiler.Engine) gin.HandlerFunc
- func Cors(c *gin.Context)
- func Database(d database.Service) 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 Queue(q queue.Service) gin.HandlerFunc
- func RequestVersion(c *gin.Context)
- func ResponseVersion(c *gin.Context)
- func Secret(secret string) gin.HandlerFunc
- func Secrets(secrets map[string]secret.Service) gin.HandlerFunc
- func Secure(c *gin.Context)
- func Source(s source.Service) gin.HandlerFunc
- func Whitelist(whitelist []string) gin.HandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compiler ¶
func Compiler(cli compiler.Engine) gin.HandlerFunc
Compiler is a middleware function that initializes the compiler and attaches to the context of every http.Request.
func Cors ¶
Cors is a middleware function that appends headers for CORS related requests. These are attached to actual requests unlike the OPTIONS preflight requests.
func Database ¶
func Database(d database.Service) gin.HandlerFunc
Database is a middleware function that initializes the database and attaches 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 preflight 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 Queue ¶
func Queue(q queue.Service) gin.HandlerFunc
Queue is a middleware function that initializes the queue and attaches 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 Secret ¶
func Secret(secret string) gin.HandlerFunc
Secret is a middleware function that attaches the secret used for server <-> agent communication to the context of every http.Request.
func Secrets ¶
func Secrets(secrets map[string]secret.Service) gin.HandlerFunc
Secrets is a middleware function that initializes the secret engines and attaches to the context of every http.Request.
func Source ¶
func Source(s source.Service) gin.HandlerFunc
Source is a middleware function that initializes the source and attaches to the context of every http.Request.
func Whitelist ¶
func Whitelist(whitelist []string) gin.HandlerFunc
Whitelist is a middleware function that attaches the whitelist used to limit which repos can be activated within the system.
Types ¶
This section is empty.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package build provides the ability for inserting Vela build resources into or extracting Vela build resources from the middleware chain for the API.
|
Package build provides the ability for inserting Vela build resources into or extracting Vela build resources from the middleware chain for the API. |
Package perm provides the ability for validating the access control to Vela resources in the middleware chain for the API.
|
Package perm provides the ability for validating the access control to Vela resources in the middleware chain for the API. |
Package repo provides the ability for inserting Vela repo resources into or extracting Vela repo resources from the middleware chain for the API.
|
Package repo provides the ability for inserting Vela repo resources into or extracting Vela repo resources from the middleware chain for the API. |
Package service provides the ability for inserting Vela service resources into or extracting Vela service resources from the middleware chain for the API.
|
Package service provides the ability for inserting Vela service resources into or extracting Vela service resources from the middleware chain for the API. |
Package step provides the ability for inserting Vela step resources into or extracting Vela step resources from the middleware chain for the API.
|
Package step provides the ability for inserting Vela step resources into or extracting Vela step 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. |
Package user provides the ability for inserting Vela user resources into or extracting Vela user resources from the middleware chain for the API.
|
Package user provides the ability for inserting Vela user resources into or extracting Vela user resources from the middleware chain for the API. |