From 423268f485f22f0ebcb29eae21cdfeeda35e516b Mon Sep 17 00:00:00 2001 From: Emile Vauge Date: Thu, 2 Jun 2016 11:37:51 +0200 Subject: [PATCH] Fix default configuration Signed-off-by: Emile Vauge --- examples/k8s.rc.yaml | 2 +- traefik.go | 29 ++++++++++++++--------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/examples/k8s.rc.yaml b/examples/k8s.rc.yaml index d7232b37d..43d3029d5 100644 --- a/examples/k8s.rc.yaml +++ b/examples/k8s.rc.yaml @@ -16,7 +16,7 @@ spec: spec: terminationGracePeriodSeconds: 60 containers: - - image: containous/traefik + - image: traefik name: traefik-ingress-lb imagePullPolicy: Always ports: diff --git a/traefik.go b/traefik.go index c440fd39c..68d1af1b3 100644 --- a/traefik.go +++ b/traefik.go @@ -97,27 +97,26 @@ func run(traefikConfiguration *TraefikConfiguration) { loggerMiddleware := middlewares.NewLogger(globalConfiguration.AccessLogsFile) defer loggerMiddleware.Close() + if globalConfiguration.File != nil && len(globalConfiguration.File.Filename) == 0 { + // no filename, setting to global config file + if len(traefikConfiguration.ConfigFile) != 0 { + globalConfiguration.File.Filename = traefikConfiguration.ConfigFile + } else { + log.Errorln("Error using file configuration backend, no filename defined") + } + } + + if len(globalConfiguration.EntryPoints) == 0 { + globalConfiguration.EntryPoints = map[string]*EntryPoint{"http": {Address: ":80"}} + globalConfiguration.DefaultEntryPoints = []string{"http"} + } + // logging level, err := log.ParseLevel(strings.ToLower(globalConfiguration.LogLevel)) if err != nil { log.Fatal("Error getting level", err) } log.SetLevel(level) - - if traefikConfiguration.File != nil && len(traefikConfiguration.File.Filename) == 0 { - // no filename, setting to global config file - if len(traefikConfiguration.ConfigFile) != 0 { - traefikConfiguration.File.Filename = traefikConfiguration.ConfigFile - } else { - log.Errorln("Error using file configuration backend, no filename defined") - } - } - - if len(traefikConfiguration.EntryPoints) == 0 { - traefikConfiguration.EntryPoints = map[string]*EntryPoint{"http": {Address: ":80"}} - traefikConfiguration.DefaultEntryPoints = []string{"http"} - } - if len(globalConfiguration.TraefikLogsFile) > 0 { fi, err := os.OpenFile(globalConfiguration.TraefikLogsFile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) defer func() {