add router handler option

This commit is contained in:
ginuerzh
2021-12-31 00:03:24 +08:00
parent a430384bba
commit 9769efe33c
35 changed files with 98 additions and 281 deletions

View File

@ -71,12 +71,12 @@ func buildService(cfg *config.Config) (services []*service.Service) {
h := registry.GetHandler(svc.Handler.Type)(
handler.BypassOption(bypasses[svc.Bypass]),
handler.LoggerOption(handlerLogger),
handler.RouterOption(&chain.Router{
Chain: chains[svc.Chain],
Logger: handlerLogger,
}),
)
if chainable, ok := h.(chain.Chainable); ok {
chainable.WithChain(chains[svc.Chain])
}
if forwarder, ok := h.(handler.Forwarder); ok {
forwarder.Forward(forwarderFromConfig(svc.Forwarder))
}