Documentation ¶
Overview ¶
Package middleware is about middlewares that must be added to chi handler. ex: r.Use(coreMiddleware.logger(dep.Components.Logger))
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ContentTypeToLogBody = []string{
"application/json",
"application/xml",
"text/json",
"text/xml",
"text/plain",
}
ContentTypeToLogBody is a list of content-type that the body will be logged.
View Source
var DontLogBodyOnSuccess = []string{
"/swagger",
"/metrics",
"/health",
}
DontLogBodyOnSuccess default prefix to not log response in case of success.
Functions ¶
func GetCustomerID ¶ added in v1.3.0
GetCustomerID retrieve id from ctx. Return -1 of type assertion fail.
Types ¶
type Info ¶ added in v1.2.0
type Info struct { // Host need to be ingress value without schema. Eg.: example.com:8080. Host string `env:"SWAGGER_HOST,required"` }
Info is used to load environment variable with the value we want to modify at run time.
func (Info) Handler ¶ added in v1.2.0
Handler refToSwaggerHost point to SwaggerInfo.Host generated value and return an http.Handler to be mounted.
First generate swagger files:
make swagger
Mount desired route invoking this method with SwaggerInfo from generated files:
r.Mount("/swagger", dep.Components.Swagger.Handler(&docs.SwaggerInfo.Host))
Click to show internal directories.
Click to hide internal directories.