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
|
2015-09-14 12:38:21 +00:00
|
|
|
globalConfiguration.Port = ":80"
|
2015-09-10 13:13:35 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2015-09-15 14:09:21 +00:00
|
|
|
type Route struct {
|
2015-09-15 16:35:32 +00:00
|
|
|
Rule string
|
2015-09-07 08:38:58 +00:00
|
|
|
Value string
|
|
|
|
}
|
|
|
|
|
2015-09-15 14:09:21 +00:00
|
|
|
type Frontend struct {
|
2015-09-09 15:41:33 +00:00
|
|
|
Backend string
|
2015-09-15 14:09:21 +00:00
|
|
|
Routes map[string]Route
|
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
|
2015-09-15 14:09:21 +00:00
|
|
|
Frontends map[string]Frontend
|
2015-09-12 13:10:03 +00:00
|
|
|
}
|