integrate tui requests handler (#392)

This commit is contained in:
Michael Quigley
2023-08-25 12:05:36 -04:00
parent 08bdc63d77
commit 52b0342078
4 changed files with 91 additions and 94 deletions

View File

@ -8,6 +8,7 @@ import (
"github.com/caddyserver/caddy/v2/modules/caddyhttp"
"github.com/caddyserver/caddy/v2/modules/caddyhttp/fileserver"
"github.com/openziti/zrok/endpoints"
"go.uber.org/zap"
"time"
)
@ -28,6 +29,8 @@ func NewCaddyWebBackend(cfg *CaddyWebBackendConfig) (*CaddyWebBackend, error) {
handler.Browse = new(fileserver.Browse)
var handlers []json.RawMessage
middlewareRequests = cfg.Requests
handlers = append(handlers, caddyconfig.JSONModuleObject(&ZrokRequestsMiddleware{}, "handler", "zrok_requests", nil))
handlers = append(handlers, caddyconfig.JSONModuleObject(handler, "handler", "file_server", nil))
route := caddyhttp.Route{HandlersRaw: handlers}
@ -55,6 +58,15 @@ func NewCaddyWebBackend(cfg *CaddyWebBackendConfig) (*CaddyWebBackend, error) {
AppsRaw: caddy.ModuleMap{
"http": caddyconfig.JSON(httpApp, nil),
},
Logging: &caddy.Logging{
Logs: map[string]*caddy.CustomLog{
"default": {
BaseLog: caddy.BaseLog{
Level: zap.ErrorLevel.CapitalString(),
},
},
},
},
}
return &CaddyWebBackend{cfg: cfg, caddyCfg: caddyCfg}, nil