Don't add TCP proxy when error occurs during creation.

This commit is contained in:
Ludovic Fernandez 2019-05-09 14:30:06 +02:00 committed by Traefiker Bot
parent 2617de2cdd
commit c2345c6e9a
6 changed files with 149 additions and 55 deletions

View file

@ -75,15 +75,6 @@ func (m *Manager) BuildHandlers(rootCtx context.Context, entryPoints []string, t
return entryPointHandlers
}
func contains(entryPoints []string, entryPointName string) bool {
for _, name := range entryPoints {
if name == entryPointName {
return true
}
}
return false
}
func (m *Manager) filteredRouters(ctx context.Context, entryPoints []string, tls bool) map[string]map[string]*config.Router {
entryPointsRouters := make(map[string]map[string]*config.Router)
@ -121,11 +112,9 @@ func (m *Manager) buildEntryPointHandler(ctx context.Context, configs map[string
}
for routerName, routerConfig := range configs {
ctxRouter := log.With(ctx, log.Str(log.RouterName, routerName))
ctxRouter := log.With(internal.AddProviderInContext(ctx, routerName), log.Str(log.RouterName, routerName))
logger := log.FromContext(ctxRouter)
ctxRouter = internal.AddProviderInContext(ctxRouter, routerName)
handler, err := m.buildRouterHandler(ctxRouter, routerName)
if err != nil {
logger.Error(err)
@ -197,3 +186,12 @@ func (m *Manager) buildHTTPHandler(ctx context.Context, router *config.Router, r
return alice.New().Extend(*mHandler).Append(tHandler).Then(sHandler)
}
func contains(entryPoints []string, entryPointName string) bool {
for _, name := range entryPoints {
if name == entryPointName {
return true
}
}
return false
}