Skip to content

Commit

Permalink
Merge pull request #102 from devopsfaith/0.9.0-dev
Browse files Browse the repository at this point in the history
Bump version 0.9.0
  • Loading branch information
kpacha authored Apr 4, 2019
2 parents cc2043f + 59ec337 commit be91845
Show file tree
Hide file tree
Showing 41 changed files with 114 additions and 77 deletions.
82 changes: 51 additions & 31 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
version = "3.3.12"

[[override]]
branch = "master"
version = "0.9.0"
name = "github.com/devopsfaith/krakend"

[[override]]
Expand All @@ -32,11 +32,11 @@
version = "1.2.0"

[[constraint]]
branch = "master"
version = "0.9.0"
name = "github.com/devopsfaith/krakend-cel"

[[constraint]]
branch = "master"
version = "0.9.0"
name = "github.com/devopsfaith/krakend-flexibleconfig"

[[constraint]]
Expand All @@ -60,7 +60,7 @@
name = "github.com/devopsfaith/krakend-circuitbreaker"

[[constraint]]
branch = "master"
version = "0.9.0"
name = "github.com/devopsfaith/krakend-cobra"

[[constraint]]
Expand All @@ -80,7 +80,11 @@
name = "github.com/devopsfaith/krakend-httpcache"

[[constraint]]
version = "0.7.0"
branch = "master"
name = "github.com/devopsfaith/krakend-amqp"

[[constraint]]
version = "0.9.0"
name = "github.com/devopsfaith/krakend-martian"

[[constraint]]
Expand All @@ -92,7 +96,7 @@
name = "github.com/devopsfaith/krakend-oauth2-clientcredentials"

[[constraint]]
version = "0.8.0"
version = "0.9.0"
name = "github.com/devopsfaith/krakend-ratelimit"

[[constraint]]
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
BIN_NAME :=krakend
DEP_VERSION=0.5.0
OS := $(shell uname | tr '[:upper:]' '[:lower:]')
VERSION := 0.8.0
VERSION := 0.9.0
PKGNAME := krakend
LICENSE := Apache 2.0
VENDOR=
Expand Down
12 changes: 12 additions & 0 deletions backend_factory.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package krakend

import (
"context"

amqp "github.com/devopsfaith/krakend-amqp"
cel "github.com/devopsfaith/krakend-cel"
cb "github.com/devopsfaith/krakend-circuitbreaker/gobreaker/proxy"
httpcache "github.com/devopsfaith/krakend-httpcache"
Expand All @@ -17,12 +20,20 @@ import (

// NewBackendFactory creates a BackendFactory by stacking all the available middlewares:
// - oauth2 client credentials
// - http cache
// - martian
// - amqp
// - cel
// - rate-limit
// - circuit breaker
// - metrics collector
// - opencensus collector
func NewBackendFactory(logger logging.Logger, metricCollector *metrics.Metrics) proxy.BackendFactory {
return NewBackendFactoryWithContext(context.Background(), logger, metricCollector)
}

// NewBackendFactory creates a BackendFactory by stacking all the available middlewares and injecting the received context
func NewBackendFactoryWithContext(ctx context.Context, logger logging.Logger, metricCollector *metrics.Metrics) proxy.BackendFactory {
requestExecutorFactory := func(cfg *config.Backend) client.HTTPRequestExecutor {
var clientFactory client.HTTPClientFactory
if _, ok := cfg.ExtraConfig[oauth2client.Namespace]; ok {
Expand All @@ -33,6 +44,7 @@ func NewBackendFactory(logger logging.Logger, metricCollector *metrics.Metrics)
return opencensus.HTTPRequestExecutor(clientFactory)
}
backendFactory := martian.NewConfiguredBackendFactory(logger, requestExecutorFactory)
backendFactory = amqp.NewBackendFactory(ctx, logger, backendFactory)
backendFactory = cel.BackendFactory(logger, backendFactory)
backendFactory = juju.BackendFactory(backendFactory)
backendFactory = cb.BackendFactory(backendFactory, logger)
Expand Down
2 changes: 1 addition & 1 deletion executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func NewExecutor(ctx context.Context) cmd.Executor {
// setup the krakend router
routerFactory := router.NewFactory(router.Config{
Engine: NewEngine(cfg, logger),
ProxyFactory: NewProxyFactory(logger, NewBackendFactory(logger, metricCollector), metricCollector),
ProxyFactory: NewProxyFactory(logger, NewBackendFactoryWithContext(ctx, logger, metricCollector), metricCollector),
Middlewares: []gin.HandlerFunc{},
Logger: logger,
HandlerFactory: NewHandlerFactory(logger, metricCollector, tokenRejecterFactory),
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/specs/backend_301.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"out": {
"status_code": 200,
"body": "{\"foo\":42,\"headers\":{\"Accept-Encoding\":[\"gzip\"],\"Referer\":[\"http://127.0.0.1:8081/redirect/?status=301\"],\"User-Agent\":[\"KrakenD Version 0.8.0\"]},\"path\":\"/param_forwarding/\",\"query\":{\"status\":[\"301\"]}}",
"body": "{\"foo\":42,\"headers\":{\"Accept-Encoding\":[\"gzip\"],\"Referer\":[\"http://127.0.0.1:8081/redirect/?status=301\"],\"User-Agent\":[\"KrakenD Version 0.9.0\"]},\"path\":\"/param_forwarding/\",\"query\":{\"status\":[\"301\"]}}",
"header": {
"content-type": "application/json; charset=utf-8",
"Cache-Control": "public, max-age=3600",
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/specs/backend_302.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"out": {
"status_code": 200,
"body": "{\"foo\":42,\"headers\":{\"Accept-Encoding\":[\"gzip\"],\"Referer\":[\"http://127.0.0.1:8081/redirect/?status=302\"],\"User-Agent\":[\"KrakenD Version 0.8.0\"]},\"path\":\"/param_forwarding/\",\"query\":{\"status\":[\"302\"]}}",
"body": "{\"foo\":42,\"headers\":{\"Accept-Encoding\":[\"gzip\"],\"Referer\":[\"http://127.0.0.1:8081/redirect/?status=302\"],\"User-Agent\":[\"KrakenD Version 0.9.0\"]},\"path\":\"/param_forwarding/\",\"query\":{\"status\":[\"302\"]}}",
"header": {
"content-type": "application/json; charset=utf-8",
"Cache-Control": "public, max-age=3600",
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/specs/backend_303.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"out": {
"status_code": 200,
"body": "{\"foo\":42,\"headers\":{\"Accept-Encoding\":[\"gzip\"],\"Referer\":[\"http://127.0.0.1:8081/redirect/?status=303\"],\"User-Agent\":[\"KrakenD Version 0.8.0\"]},\"path\":\"/param_forwarding/\",\"query\":{\"status\":[\"303\"]}}",
"body": "{\"foo\":42,\"headers\":{\"Accept-Encoding\":[\"gzip\"],\"Referer\":[\"http://127.0.0.1:8081/redirect/?status=303\"],\"User-Agent\":[\"KrakenD Version 0.9.0\"]},\"path\":\"/param_forwarding/\",\"query\":{\"status\":[\"303\"]}}",
"header": {
"content-type": "application/json; charset=utf-8",
"Cache-Control": "public, max-age=3600",
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/specs/backend_307.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"out": {
"status_code": 200,
"body": "{\"foo\":42,\"headers\":{\"Accept-Encoding\":[\"gzip\"],\"Referer\":[\"http://127.0.0.1:8081/redirect/?status=307\"],\"User-Agent\":[\"KrakenD Version 0.8.0\"]},\"path\":\"/param_forwarding/\",\"query\":{\"status\":[\"307\"]}}",
"body": "{\"foo\":42,\"headers\":{\"Accept-Encoding\":[\"gzip\"],\"Referer\":[\"http://127.0.0.1:8081/redirect/?status=307\"],\"User-Agent\":[\"KrakenD Version 0.9.0\"]},\"path\":\"/param_forwarding/\",\"query\":{\"status\":[\"307\"]}}",
"header": {
"content-type": "application/json; charset=utf-8",
"Cache-Control": "public, max-age=3600",
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/specs/backend_404.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
"X-Krakend-Completed": "false"
}
}
}
}
5 changes: 3 additions & 2 deletions tests/fixtures/specs/cel-1.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"body": "",
"header": {
"content-type": "",
"Cache-Control": ""
"Cache-Control": "",
"X-Krakend-Completed": "false"
}
}
}
}
Loading

0 comments on commit be91845

Please sign in to comment.