1
0
Fork 0

Enables the use of elements declared in other providers

This commit is contained in:
Gérald Croës 2019-01-15 05:28:04 -08:00 committed by Traefiker Bot
parent a79d6aa669
commit 8735263930
16 changed files with 753 additions and 94 deletions

View file

@ -14,17 +14,13 @@ const (
)
type chainBuilder interface {
BuildChain(ctx context.Context, middlewares []string) (*alice.Chain, error)
BuildChain(ctx context.Context, middlewares []string) *alice.Chain
}
// New creates a chain middleware
func New(ctx context.Context, next http.Handler, config config.Chain, builder chainBuilder, name string) (http.Handler, error) {
middlewares.GetLogger(ctx, name, typeName).Debug("Creating middleware")
middlewareChain, err := builder.BuildChain(ctx, config.Middlewares)
if err != nil {
return nil, err
}
middlewareChain := builder.BuildChain(ctx, config.Middlewares)
return middlewareChain.Then(next)
}