1
0
Fork 0

Move dynamic config into a dedicated package.

This commit is contained in:
Ludovic Fernandez 2019-07-10 09:26:04 +02:00 committed by Traefiker Bot
parent 09cc1161c9
commit c8bf8e896a
102 changed files with 3170 additions and 3166 deletions

View file

@ -7,7 +7,7 @@ import (
"net/http"
"github.com/containous/mux"
"github.com/containous/traefik/pkg/config"
"github.com/containous/traefik/pkg/config/dynamic"
"github.com/containous/traefik/pkg/log"
"github.com/containous/traefik/pkg/provider"
"github.com/containous/traefik/pkg/safe"
@ -18,7 +18,7 @@ var _ provider.Provider = (*Provider)(nil)
// Provider is a provider.Provider implementation that provides a Rest API.
type Provider struct {
configurationChan chan<- config.Message
configurationChan chan<- dynamic.Message
EntryPoint string `description:"EntryPoint." json:"entryPoint,omitempty" toml:"entryPoint,omitempty" yaml:"entryPoint,omitempty" export:"true"`
}
@ -48,7 +48,7 @@ func (p *Provider) Append(systemRouter *mux.Router) {
return
}
configuration := new(config.HTTPConfiguration)
configuration := new(dynamic.HTTPConfiguration)
body, _ := ioutil.ReadAll(request.Body)
if err := json.Unmarshal(body, configuration); err != nil {
@ -57,7 +57,7 @@ func (p *Provider) Append(systemRouter *mux.Router) {
return
}
p.configurationChan <- config.Message{ProviderName: "rest", Configuration: &config.Configuration{
p.configurationChan <- dynamic.Message{ProviderName: "rest", Configuration: &dynamic.Configuration{
HTTP: configuration,
}}
if err := templatesRenderer.JSON(response, http.StatusOK, configuration); err != nil {
@ -68,7 +68,7 @@ func (p *Provider) Append(systemRouter *mux.Router) {
// Provide allows the provider to provide configurations to traefik
// using the given configuration channel.
func (p *Provider) Provide(configurationChan chan<- config.Message, pool *safe.Pool) error {
func (p *Provider) Provide(configurationChan chan<- dynamic.Message, pool *safe.Pool) error {
p.configurationChan = configurationChan
return nil
}