1
0
Fork 0

Add basic authentication support in Marathon

This commit is contained in:
emile 2016-01-18 11:52:18 +01:00
parent 707b6f9a95
commit c46ffed846
No known key found for this signature in database
GPG key ID: D808B4C167352E59
4 changed files with 26 additions and 14 deletions

View file

@ -18,9 +18,16 @@ type Marathon struct {
Endpoint string
Domain string
NetworkInterface string
Basic *MarathonBasic
marathonClient lightMarathonClient
}
// MarathonBasic holds basic authentication specific configurations
type MarathonBasic struct {
HTTPBasicAuthUser string
HTTPBasicPassword string
}
type lightMarathonClient interface {
Applications(url.Values) (*marathon.Applications, error)
AllTasks(v url.Values) (*marathon.Tasks, error)
@ -32,6 +39,10 @@ func (provider *Marathon) Provide(configurationChan chan<- types.ConfigMessage)
config := marathon.NewDefaultConfig()
config.URL = provider.Endpoint
config.EventsInterface = provider.NetworkInterface
if provider.Basic != nil {
config.HTTPBasicAuthUser = provider.Basic.HTTPBasicAuthUser
config.HTTPBasicPassword = provider.Basic.HTTPBasicPassword
}
client, err := marathon.NewClient(config)
if err != nil {
log.Errorf("Failed to create a client for marathon, error: %s", err)