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