New static configuration loading system.

Co-authored-by: Mathieu Lonjaret <mathieu.lonjaret@gmail.com>
This commit is contained in:
Ludovic Fernandez 2019-06-17 11:48:05 +02:00 committed by Traefiker Bot
parent d18edd6f77
commit 8d7eccad5d
165 changed files with 10894 additions and 6076 deletions

View file

@ -83,7 +83,7 @@ func createHTTPTransport(transportConfiguration *static.ServersTransport) (*http
return transport, nil
}
func createRootCACertPool(rootCAs traefiktls.FilesOrContents) *x509.CertPool {
func createRootCACertPool(rootCAs []traefiktls.FileOrContent) *x509.CertPool {
roots := x509.NewCertPool()
for _, cert := range rootCAs {

View file

@ -8,9 +8,9 @@ import (
"testing"
"time"
"github.com/containous/flaeg/parse"
"github.com/containous/traefik/pkg/config/static"
"github.com/containous/traefik/pkg/tcp"
"github.com/containous/traefik/pkg/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@ -21,7 +21,7 @@ func TestShutdownHTTP(t *testing.T) {
Transport: &static.EntryPointsTransport{
LifeCycle: &static.LifeCycle{
RequestAcceptGraceTimeout: 0,
GraceTimeOut: parse.Duration(5 * time.Second),
GraceTimeOut: types.Duration(5 * time.Second),
},
},
ForwardedHeaders: &static.ForwardedHeaders{},
@ -59,7 +59,7 @@ func TestShutdownHTTPHijacked(t *testing.T) {
Transport: &static.EntryPointsTransport{
LifeCycle: &static.LifeCycle{
RequestAcceptGraceTimeout: 0,
GraceTimeOut: parse.Duration(5 * time.Second),
GraceTimeOut: types.Duration(5 * time.Second),
},
},
ForwardedHeaders: &static.ForwardedHeaders{},
@ -103,7 +103,7 @@ func TestShutdownTCPConn(t *testing.T) {
Transport: &static.EntryPointsTransport{
LifeCycle: &static.LifeCycle{
RequestAcceptGraceTimeout: 0,
GraceTimeOut: parse.Duration(5 * time.Second),
GraceTimeOut: types.Duration(5 * time.Second),
},
},
ForwardedHeaders: &static.ForwardedHeaders{},

View file

@ -7,10 +7,10 @@ import (
"testing"
"time"
"github.com/containous/flaeg/parse"
"github.com/containous/traefik/pkg/config"
"github.com/containous/traefik/pkg/config/static"
th "github.com/containous/traefik/pkg/testhelpers"
"github.com/containous/traefik/pkg/types"
"github.com/stretchr/testify/assert"
)
@ -132,7 +132,7 @@ func setupListenProvider(throttleDuration time.Duration) (server *Server, stop c
staticConfiguration := static.Configuration{
Providers: &static.Providers{
ProvidersThrottleDuration: parse.Duration(throttleDuration),
ProvidersThrottleDuration: types.Duration(throttleDuration),
},
}

View file

@ -10,9 +10,9 @@ import (
"net/url"
"time"
"github.com/containous/flaeg/parse"
"github.com/containous/traefik/pkg/config"
"github.com/containous/traefik/pkg/log"
"github.com/containous/traefik/pkg/types"
)
// StatusClientClosedRequest non-standard HTTP status code for client disconnection
@ -22,7 +22,7 @@ const StatusClientClosedRequest = 499
const StatusClientClosedRequestText = "Client Closed Request"
func buildProxy(passHostHeader bool, responseForwarding *config.ResponseForwarding, defaultRoundTripper http.RoundTripper, bufferPool httputil.BufferPool, responseModifier func(*http.Response) error) (http.Handler, error) {
var flushInterval parse.Duration
var flushInterval types.Duration
if responseForwarding != nil {
err := flushInterval.Set(responseForwarding.FlushInterval)
if err != nil {
@ -30,7 +30,7 @@ func buildProxy(passHostHeader bool, responseForwarding *config.ResponseForwardi
}
}
if flushInterval == 0 {
flushInterval = parse.Duration(100 * time.Millisecond)
flushInterval = types.Duration(100 * time.Millisecond)
}
proxy := &httputil.ReverseProxy{