Partial default values

This commit is contained in:
emile 2015-09-11 19:32:23 +02:00
parent 95557a8dba
commit 388a7f6ab5
3 changed files with 27 additions and 0 deletions

View file

@ -18,6 +18,15 @@ type DockerProvider struct {
Domain string
}
func NewDockerProvider() *DockerProvider {
dockerProvider := new(DockerProvider)
// default
dockerProvider.Watch = true
dockerProvider.Domain = "traefik"
return dockerProvider
}
var DockerFuncMap = template.FuncMap{
"getBackend": func(container docker.Container) string {
for key, value := range container.Config.Labels {

View file

@ -13,6 +13,14 @@ type FileProvider struct {
Filename string
}
func NewFileProvider() *FileProvider {
fileProvider := new(FileProvider)
// default values
fileProvider.Watch = true
return fileProvider
}
func (provider *FileProvider) Provide(configurationChan chan<- *Configuration){
watcher, err := fsnotify.NewWatcher()
if err != nil {

View file

@ -19,6 +19,16 @@ type MarathonProvider struct {
NetworkInterface string
}
func NewMarathonProvider() *MarathonProvider {
marathonProvider := new(MarathonProvider)
// default values
marathonProvider.Watch = true
marathonProvider.Domain = "traefik"
marathonProvider.NetworkInterface = "eth0"
return marathonProvider
}
var MarathonFuncMap = template.FuncMap{
"getPort": func(task marathon.Task) string {
for _, port := range task.Ports {