* API: Using go-swagger for extracting OpenAPI specification from source code
* Merge Grafana Alerting spec
* Include enterprise endpoints (if enabled)
* Serve SwaggerUI under feature flag
* Fix building dev docker images
* Configure swaggerUI
* Add missing json tags
Co-authored-by: Ying WANG <ying.wang@grafana.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
(cherry picked from commit 35fe58de37)
This commit is contained in:
@@ -52,6 +52,8 @@ type StaticOptions struct {
|
||||
AddHeaders func(ctx *web.Context)
|
||||
// FileSystem is the interface for supporting any implementation of file system.
|
||||
FileSystem http.FileSystem
|
||||
// Exclude paths from being served
|
||||
Exclude []string
|
||||
}
|
||||
|
||||
// FIXME: to be deleted.
|
||||
@@ -121,6 +123,12 @@ func staticHandler(ctx *web.Context, log log.Logger, opt StaticOptions) bool {
|
||||
}
|
||||
|
||||
file := ctx.Req.URL.Path
|
||||
for _, p := range opt.Exclude {
|
||||
if file == p {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// if we have a prefix, filter requests by stripping the prefix
|
||||
if opt.Prefix != "" {
|
||||
if !strings.HasPrefix(file, opt.Prefix) {
|
||||
|
||||
Reference in New Issue
Block a user