2015-09-07 10:38:58 +02:00
|
|
|
package main
|
|
|
|
|
2015-09-10 15:13:35 +02:00
|
|
|
type GlobalConfiguration struct {
|
2015-09-11 16:37:13 +02:00
|
|
|
Port string
|
|
|
|
GraceTimeOut int64
|
|
|
|
AccessLogsFile string
|
|
|
|
TraefikLogsFile string
|
|
|
|
TraefikLogsStdout bool
|
2015-09-11 16:48:52 +02:00
|
|
|
CertFile, KeyFile string
|
2015-09-11 16:37:13 +02:00
|
|
|
LogLevel string
|
|
|
|
Docker *DockerProvider
|
|
|
|
File *FileProvider
|
|
|
|
Web *WebProvider
|
|
|
|
Marathon *MarathonProvider
|
2015-09-21 18:05:56 +02:00
|
|
|
Consul *ConsulProvider
|
2015-09-10 15:13:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewGlobalConfiguration() *GlobalConfiguration {
|
|
|
|
globalConfiguration := new(GlobalConfiguration)
|
|
|
|
// default values
|
2015-09-14 14:38:21 +02:00
|
|
|
globalConfiguration.Port = ":80"
|
2015-09-10 15:13:35 +02:00
|
|
|
globalConfiguration.GraceTimeOut = 10
|
2015-09-11 16:40:54 +02:00
|
|
|
globalConfiguration.LogLevel = "ERROR"
|
|
|
|
globalConfiguration.TraefikLogsStdout = true
|
2015-09-10 15:13:35 +02:00
|
|
|
|
|
|
|
return globalConfiguration
|
|
|
|
}
|
2015-09-07 10:38:58 +02:00
|
|
|
|
|
|
|
type Backend struct {
|
|
|
|
Servers map[string]Server
|
|
|
|
}
|
|
|
|
|
|
|
|
type Server struct {
|
2015-09-11 16:37:13 +02:00
|
|
|
Url string
|
2015-09-10 16:14:08 +02:00
|
|
|
Weight int
|
2015-09-07 10:38:58 +02:00
|
|
|
}
|
|
|
|
|
2015-09-15 16:09:21 +02:00
|
|
|
type Route struct {
|
2015-09-15 22:32:09 +02:00
|
|
|
Rule string
|
|
|
|
Value string
|
2015-09-07 10:38:58 +02:00
|
|
|
}
|
|
|
|
|
2015-09-15 16:09:21 +02:00
|
|
|
type Frontend struct {
|
2015-09-09 17:41:33 +02:00
|
|
|
Backend string
|
2015-09-15 22:32:09 +02:00
|
|
|
Routes map[string]Route
|
2015-09-07 10:38:58 +02:00
|
|
|
}
|
|
|
|
|
2015-09-08 00:15:14 +02:00
|
|
|
type Configuration struct {
|
2015-09-15 22:32:09 +02:00
|
|
|
Backends map[string]Backend
|
2015-09-15 16:09:21 +02:00
|
|
|
Frontends map[string]Frontend
|
2015-09-12 15:10:03 +02:00
|
|
|
}
|