Entry point redirection and default routers configuration

Co-authored-by: Julien Salleyron <julien.salleyron@gmail.com>
Co-authored-by: Mathieu Lonjaret <mathieu.lonjaret@gmail.com>
This commit is contained in:
Traefiker Bot 2020-03-05 12:46:05 +01:00 committed by GitHub
parent 93a7af270f
commit a6040c623b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 1016 additions and 126 deletions

View file

@ -18,6 +18,8 @@ import (
type ConfigurationWatcher struct {
provider provider.Provider
entryPoints []string
providersThrottleDuration time.Duration
currentConfigurations safe.Safe
@ -32,7 +34,12 @@ type ConfigurationWatcher struct {
}
// NewConfigurationWatcher creates a new ConfigurationWatcher.
func NewConfigurationWatcher(routinesPool *safe.Pool, pvd provider.Provider, providersThrottleDuration time.Duration) *ConfigurationWatcher {
func NewConfigurationWatcher(
routinesPool *safe.Pool,
pvd provider.Provider,
providersThrottleDuration time.Duration,
entryPoints []string,
) *ConfigurationWatcher {
watcher := &ConfigurationWatcher{
provider: pvd,
configurationChan: make(chan dynamic.Message, 100),
@ -40,6 +47,7 @@ func NewConfigurationWatcher(routinesPool *safe.Pool, pvd provider.Provider, pro
providerConfigUpdateMap: make(map[string]chan dynamic.Message),
providersThrottleDuration: providersThrottleDuration,
routinesPool: routinesPool,
entryPoints: entryPoints,
}
currentConfigurations := make(dynamic.Configurations)
@ -135,7 +143,8 @@ func (c *ConfigurationWatcher) loadMessage(configMsg dynamic.Message) {
c.currentConfigurations.Set(newConfigurations)
conf := mergeConfiguration(newConfigurations)
conf := mergeConfiguration(newConfigurations, c.entryPoints)
conf = applyModel(conf)
for _, listener := range c.configurationListeners {
listener(conf)