Split a bit traefik into package. The idea behind this refactor is to start move inter-dependencies away and do some DRY or SRP. - Adds a `provider` package, with providers except `web.go` - Adds a `types` package with common struct. - Move `gen.go` to an `autogen` package Signed-off-by: Vincent Demeester <vincent@sbr.pm>
40 lines
1.2 KiB
Go
40 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/emilevauge/traefik/provider"
|
|
"github.com/emilevauge/traefik/types"
|
|
)
|
|
|
|
type GlobalConfiguration struct {
|
|
Port string
|
|
GraceTimeOut int64
|
|
AccessLogsFile string
|
|
TraefikLogsFile string
|
|
CertFile, KeyFile string
|
|
LogLevel string
|
|
ProvidersThrottleDuration time.Duration
|
|
Docker *provider.DockerProvider
|
|
File *provider.FileProvider
|
|
Web *WebProvider
|
|
Marathon *provider.MarathonProvider
|
|
Consul *provider.ConsulProvider
|
|
Etcd *provider.EtcdProvider
|
|
Zookeeper *provider.ZookepperProvider
|
|
Boltdb *provider.BoltDbProvider
|
|
}
|
|
|
|
func NewGlobalConfiguration() *GlobalConfiguration {
|
|
globalConfiguration := new(GlobalConfiguration)
|
|
// default values
|
|
globalConfiguration.Port = ":80"
|
|
globalConfiguration.GraceTimeOut = 10
|
|
globalConfiguration.LogLevel = "ERROR"
|
|
globalConfiguration.ProvidersThrottleDuration = time.Duration(2 * time.Second)
|
|
|
|
return globalConfiguration
|
|
}
|
|
|
|
type configs map[string]*types.Configuration
|