2015-11-01 15:35:01 +00:00
|
|
|
package provider
|
|
|
|
|
2015-11-13 10:50:32 +00:00
|
|
|
import (
|
2016-04-13 18:36:23 +00:00
|
|
|
"github.com/containous/traefik/safe"
|
2016-02-24 15:43:39 +00:00
|
|
|
"github.com/containous/traefik/types"
|
2015-11-13 10:50:32 +00:00
|
|
|
"github.com/docker/libkv/store"
|
|
|
|
"github.com/docker/libkv/store/consul"
|
|
|
|
)
|
2015-09-21 16:05:56 +00:00
|
|
|
|
2015-11-01 18:29:47 +00:00
|
|
|
// Consul holds configurations of the Consul provider.
|
2015-11-02 18:48:34 +00:00
|
|
|
type Consul struct {
|
2016-01-13 21:46:44 +00:00
|
|
|
Kv `mapstructure:",squash"`
|
2015-09-21 16:05:56 +00:00
|
|
|
}
|
|
|
|
|
2015-11-01 18:29:47 +00:00
|
|
|
// Provide allows the provider to provide configurations to traefik
|
|
|
|
// using the given configuration channel.
|
2016-04-13 18:36:23 +00:00
|
|
|
func (provider *Consul) Provide(configurationChan chan<- types.ConfigMessage, pool *safe.Pool) error {
|
2016-01-13 21:46:44 +00:00
|
|
|
provider.storeType = store.CONSUL
|
2015-11-13 10:50:32 +00:00
|
|
|
consul.Register()
|
2016-04-13 18:36:23 +00:00
|
|
|
return provider.provide(configurationChan, pool)
|
2015-09-21 16:05:56 +00:00
|
|
|
}
|