Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
1ba95183
Unverified
Commit
1ba95183
authored
Jul 23, 2020
by
Agnès Toulet
Committed by
GitHub
Jul 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HTTPServer: add possibility to use additional middlewares (#26514)
parent
b12d08d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
pkg/api/http_server.go
+9
-0
No files found.
pkg/api/http_server.go
View file @
1ba95183
...
@@ -53,6 +53,7 @@ type HTTPServer struct {
...
@@ -53,6 +53,7 @@ type HTTPServer struct {
context
context
.
Context
context
context
.
Context
streamManager
*
live
.
StreamManager
streamManager
*
live
.
StreamManager
httpSrv
*
http
.
Server
httpSrv
*
http
.
Server
middlewares
[]
macaron
.
Handler
RouteRegister
routing
.
RouteRegister
`inject:""`
RouteRegister
routing
.
RouteRegister
`inject:""`
Bus
bus
.
Bus
`inject:""`
Bus
bus
.
Bus
`inject:""`
...
@@ -82,6 +83,10 @@ func (hs *HTTPServer) Init() error {
...
@@ -82,6 +83,10 @@ func (hs *HTTPServer) Init() error {
return
nil
return
nil
}
}
func
(
hs
*
HTTPServer
)
AddMiddleware
(
middleware
macaron
.
Handler
)
{
hs
.
middlewares
=
append
(
hs
.
middlewares
,
middleware
)
}
func
(
hs
*
HTTPServer
)
Run
(
ctx
context
.
Context
)
error
{
func
(
hs
*
HTTPServer
)
Run
(
ctx
context
.
Context
)
error
{
hs
.
context
=
ctx
hs
.
context
=
ctx
...
@@ -323,6 +328,10 @@ func (hs *HTTPServer) addMiddlewaresAndStaticRoutes() {
...
@@ -323,6 +328,10 @@ func (hs *HTTPServer) addMiddlewaresAndStaticRoutes() {
}
}
m
.
Use
(
middleware
.
HandleNoCacheHeader
())
m
.
Use
(
middleware
.
HandleNoCacheHeader
())
for
_
,
mw
:=
range
hs
.
middlewares
{
m
.
Use
(
mw
)
}
}
}
func
(
hs
*
HTTPServer
)
metricsEndpoint
(
ctx
*
macaron
.
Context
)
{
func
(
hs
*
HTTPServer
)
metricsEndpoint
(
ctx
*
macaron
.
Context
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment