Documentation ¶
Index ¶
- Constants
- Variables
- func MetricsHandler(cfg MetricsConfig) func(next http.Handler) http.Handler
- func Paginate(next http.Handler) http.Handler
- func RoleCheck(allowedRoles []string) func(next http.Handler) http.Handler
- func SysAPIHandler(cfg SysAPIConfig) func(next http.Handler) http.Handler
- func TraceEnhancer(next http.Handler) http.Handler
- type MetricsConfig
- type SysAPIConfig
Constants ¶
View Source
const APIKeyHeaderKey = "apikey"
APIKeyHeader in this header thr right api key should be inserted
Variables ¶
View Source
var ( ContextKeyOffset = contextKey("offset") ContextKeyLimit = contextKey("limit") )
Functions ¶
func MetricsHandler ¶
func MetricsHandler(cfg MetricsConfig) func(next http.Handler) http.Handler
MetricsHandler creates a new directly usable handler
func Paginate ¶
Paginate is a middleware logic for populating the context with offset and limit values
func RoleCheck ¶
RoleCheck implements a simple middleware handler for adding basic http auth to a route.
func SysAPIHandler ¶
func SysAPIHandler(cfg SysAPIConfig) func(next http.Handler) http.Handler
SysAPIHandler creates a new directly usable handler
Types ¶
type MetricsConfig ¶
type MetricsConfig struct { // Skip particular requests from the handler SkipFunc func(r *http.Request) bool }
MetricsConfig defining a handler for checking system id and api key
Click to show internal directories.
Click to hide internal directories.