Adding caching and merging of configurations

Configurations are now cached from each provider separately so that
we can merge them together when one provider has changed config.

The Web module also returns full config info through the HTML call,
but REST API is working on a separate web configuration that is
sent in just like any other.
This commit is contained in:
Thorhallur Sverrisson 2015-09-22 04:16:21 +00:00
parent 537c5c18dd
commit f534d8817f
7 changed files with 124 additions and 88 deletions

View file

@ -67,7 +67,7 @@ var MarathonFuncMap = template.FuncMap{
},
}
func (provider *MarathonProvider) Provide(configurationChan chan<- *Configuration) {
func (provider *MarathonProvider) Provide(configurationChan chan<- configMessage) {
config := marathon.NewDefaultConfig()
config.URL = provider.Endpoint
config.EventsInterface = provider.NetworkInterface
@ -88,7 +88,7 @@ func (provider *MarathonProvider) Provide(configurationChan chan<- *Configuratio
log.Debug("Marathon event receveived", event)
configuration := provider.loadMarathonConfig()
if configuration != nil {
configurationChan <- configuration
configurationChan <- configMessage{"marathon", configuration}
}
}
}()
@ -96,7 +96,7 @@ func (provider *MarathonProvider) Provide(configurationChan chan<- *Configuratio
}
configuration := provider.loadMarathonConfig()
configurationChan <- configuration
configurationChan <- configMessage{"marathon", configuration}
}
func (provider *MarathonProvider) loadMarathonConfig() *Configuration {