forked from krakend/krakend-ce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
proxy_factory.go
29 lines (25 loc) · 1.27 KB
/
proxy_factory.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package krakend
import (
cel "github.com/devopsfaith/krakend-cel"
jsonschema "github.com/devopsfaith/krakend-jsonschema"
lua "github.com/devopsfaith/krakend-lua/proxy"
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 = lua.ProxyFactory(logger, proxyFactory)
proxyFactory = metricCollector.ProxyFactory("pipe", proxyFactory)
proxyFactory = opencensus.ProxyFactory(proxyFactory)
return proxyFactory
}
type proxyFactory struct{}
func (p proxyFactory) NewProxyFactory(logger logging.Logger, backendFactory proxy.BackendFactory, metricCollector *metrics.Metrics) proxy.Factory {
return NewProxyFactory(logger, backendFactory, metricCollector)
}