From 5dea2e79020b94cae5b239bd05b9d696549c023b Mon Sep 17 00:00:00 2001 From: emile Date: Thu, 22 Oct 2015 14:02:14 +0200 Subject: [PATCH] Remove providerTemplates dir, moved in templates --- docker.go | 2 +- docs/index.md | 2 +- generate.go | 2 +- kv.go | 2 +- marathon.go | 2 +- {providerTemplates => templates}/docker.tmpl | 0 {providerTemplates => templates}/kv.tmpl | 0 {providerTemplates => templates}/marathon-prefix.tmpl | 0 {providerTemplates => templates}/marathon.tmpl | 0 traefik.go | 6 ------ web.go | 7 +++++++ 11 files changed, 12 insertions(+), 11 deletions(-) rename {providerTemplates => templates}/docker.tmpl (100%) rename {providerTemplates => templates}/kv.tmpl (100%) rename {providerTemplates => templates}/marathon-prefix.tmpl (100%) rename {providerTemplates => templates}/marathon.tmpl (100%) diff --git a/docker.go b/docker.go index aefe0efdb..017ef596c 100644 --- a/docker.go +++ b/docker.go @@ -162,7 +162,7 @@ func (provider *DockerProvider) loadDockerConfig(dockerClient *docker.Client) *C return nil } } else { - buf, err := Asset("providerTemplates/docker.tmpl") + buf, err := Asset("templates/docker.tmpl") if err != nil { log.Error("Error reading file", err) } diff --git a/docs/index.md b/docs/index.md index ffdd05d7b..793e85a20 100644 --- a/docs/index.md +++ b/docs/index.md @@ -469,7 +469,7 @@ Labels can be used on containers to override default behaviour: - `traefik.weight=10`: assign this weight to the application - `traefik.enable=false`: disable this application in Træfɪk - `traefik.host=bar`: override the default routing from `{appName}.{domain}` to `bar.{domain}` -- `traefik.prefixes=pf1,pf2`: use `PathPrefix(es)` instead of hostname for routing, use `filename="providerTemplates/marathon-prefix.tmpl"` with this option +- `traefik.prefixes=pf1,pf2`: use `PathPrefix(es)` instead of hostname for routing, use `filename="templates/marathon-prefix.tmpl"` with this option * `traefik.domain=traefik.localhost`: override the default domain ## Consul backend diff --git a/generate.go b/generate.go index 4757a70bd..f7b6e4ec3 100644 --- a/generate.go +++ b/generate.go @@ -4,6 +4,6 @@ Copyright //go:generate go get github.com/jteeuwen/go-bindata/... //go:generate rm -vf gen.go -//go:generate go-bindata -o gen.go static/... templates/... providerTemplates/... +//go:generate go-bindata -o gen.go static/... templates/... package main diff --git a/kv.go b/kv.go index 4d3f7dd82..afe240d13 100644 --- a/kv.go +++ b/kv.go @@ -166,7 +166,7 @@ func (provider *KvProvider) loadConfig() *Configuration { return nil } } else { - buf, err := Asset("providerTemplates/kv.tmpl") + buf, err := Asset("templates/kv.tmpl") if err != nil { log.Error("Error reading file", err) } diff --git a/marathon.go b/marathon.go index 46b197007..c852ce8c1 100644 --- a/marathon.go +++ b/marathon.go @@ -167,7 +167,7 @@ func (provider *MarathonProvider) loadMarathonConfig() *Configuration { return nil } } else { - buf, err := Asset("providerTemplates/marathon.tmpl") + buf, err := Asset("templates/marathon.tmpl") if err != nil { log.Error("Error reading file", err) } diff --git a/providerTemplates/docker.tmpl b/templates/docker.tmpl similarity index 100% rename from providerTemplates/docker.tmpl rename to templates/docker.tmpl diff --git a/providerTemplates/kv.tmpl b/templates/kv.tmpl similarity index 100% rename from providerTemplates/kv.tmpl rename to templates/kv.tmpl diff --git a/providerTemplates/marathon-prefix.tmpl b/templates/marathon-prefix.tmpl similarity index 100% rename from providerTemplates/marathon-prefix.tmpl rename to templates/marathon-prefix.tmpl diff --git a/providerTemplates/marathon.tmpl b/templates/marathon.tmpl similarity index 100% rename from providerTemplates/marathon.tmpl rename to templates/marathon.tmpl diff --git a/traefik.go b/traefik.go index e32f0a711..63b83e70b 100644 --- a/traefik.go +++ b/traefik.go @@ -23,7 +23,6 @@ import ( "github.com/mailgun/oxy/forward" "github.com/mailgun/oxy/roundrobin" "github.com/thoas/stats" - "github.com/unrolled/render" "gopkg.in/alecthomas/kingpin.v2" "runtime" ) @@ -36,11 +35,6 @@ var ( currentConfigurations = make(configs) metrics = stats.New() oxyLogger = &OxyLogger{} - templatesRenderer = render.New(render.Options{ - Directory: "templates", - Asset: Asset, - AssetNames: AssetNames, - }) ) func main() { diff --git a/web.go b/web.go index ed2d4f70f..1d4db0617 100644 --- a/web.go +++ b/web.go @@ -9,6 +9,7 @@ import ( log "github.com/Sirupsen/logrus" "github.com/elazarl/go-bindata-assetfs" "github.com/gorilla/mux" + "github.com/unrolled/render" ) type WebProvider struct { @@ -16,6 +17,12 @@ type WebProvider struct { CertFile, KeyFile string } +var ( + templatesRenderer = render.New(render.Options{ + Directory: "nowhere", + }) +) + func (provider *WebProvider) Provide(configurationChan chan<- configMessage) error { systemRouter := mux.NewRouter()