forked from krakend/krakend-ce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
proxy_factory.go
21 lines (19 loc) · 957 Bytes
/
proxy_factory.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package krakend
import (
cel "github.com/devopsfaith/krakend-cel"
jsonschema "github.com/devopsfaith/krakend-jsonschema"
metrics "github.com/devopsfaith/krakend-metrics/gin"
opencensus "github.com/devopsfaith/krakend-opencensus"
"github.com/devopsfaith/krakend/logging"
"github.com/devopsfaith/krakend/proxy"
)
// NewProxyFactory returns a new ProxyFactory wrapping the injected BackendFactory with the default proxy stack and a metrics collector
func NewProxyFactory(logger logging.Logger, backendFactory proxy.BackendFactory, metricCollector *metrics.Metrics) proxy.Factory {
proxyFactory := proxy.NewDefaultFactory(backendFactory, logger)
proxyFactory = proxy.NewShadowFactory(proxyFactory)
proxyFactory = jsonschema.ProxyFactory(proxyFactory)
proxyFactory = cel.ProxyFactory(logger, proxyFactory)
proxyFactory = metricCollector.ProxyFactory("pipe", proxyFactory)
proxyFactory = opencensus.ProxyFactory(proxyFactory)
return proxyFactory
}