fix: YML example of template for the file provider.
This commit is contained in:
parent
f6c6c2b2c0
commit
664cd940c5
1 changed files with 18 additions and 17 deletions
|
@ -194,8 +194,11 @@ providers:
|
||||||
Go Templating only works along with dedicated dynamic configuration files.
|
Go Templating only works along with dedicated dynamic configuration files.
|
||||||
Templating does not work in the Traefik main static configuration file.
|
Templating does not work in the Traefik main static configuration file.
|
||||||
|
|
||||||
Traefik allows using Go templating.
|
Traefik allows using Go templating,
|
||||||
Thus, it's possible to define easily lot of routers, services and TLS certificates as described in the file `template-rules.toml` :
|
it must be a valid [Go template](https://golang.org/pkg/text/template/),
|
||||||
|
augmented with the [sprig template functions](http://masterminds.github.io/sprig/).
|
||||||
|
|
||||||
|
Thus, it's possible to define easily lot of routers, services and TLS certificates as described in the following examples:
|
||||||
|
|
||||||
??? example "Configuring Using Templating"
|
??? example "Configuring Using Templating"
|
||||||
|
|
||||||
|
@ -205,7 +208,7 @@ Thus, it's possible to define easily lot of routers, services and TLS certificat
|
||||||
|
|
||||||
[http.routers]
|
[http.routers]
|
||||||
{{ range $i, $e := until 100 }}
|
{{ range $i, $e := until 100 }}
|
||||||
[http.routers.router{{ $e }}]
|
[http.routers.router{{ $e }}-{{ env "MY_ENV_VAR" }}]
|
||||||
# ...
|
# ...
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
@ -247,36 +250,34 @@ Thus, it's possible to define easily lot of routers, services and TLS certificat
|
||||||
|
|
||||||
```yaml tab="YAML"
|
```yaml tab="YAML"
|
||||||
http:
|
http:
|
||||||
|
|
||||||
{{range $i, $e := until 100 }}
|
|
||||||
routers:
|
routers:
|
||||||
router{{ $e }:
|
{{range $i, $e := until 100 }}
|
||||||
|
router{{ $e }}-{{ env "MY_ENV_VAR" }}:
|
||||||
# ...
|
# ...
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{range $i, $e := until 100 }}
|
|
||||||
services:
|
services:
|
||||||
|
{{range $i, $e := until 100 }}
|
||||||
application{{ $e }}:
|
application{{ $e }}:
|
||||||
# ...
|
# ...
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
tcp:
|
tcp:
|
||||||
|
|
||||||
{{range $i, $e := until 100 }}
|
|
||||||
routers:
|
routers:
|
||||||
router{{ $e }:
|
{{range $i, $e := until 100 }}
|
||||||
|
router{{ $e }}:
|
||||||
# ...
|
# ...
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{range $i, $e := until 100 }}
|
|
||||||
services:
|
services:
|
||||||
|
{{range $i, $e := until 100 }}
|
||||||
service{{ $e }}:
|
service{{ $e }}:
|
||||||
# ...
|
# ...
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{ range $i, $e := until 10 }}
|
|
||||||
tls:
|
tls:
|
||||||
certificates:
|
certificates:
|
||||||
|
{{ range $i, $e := until 10 }}
|
||||||
- certFile: "/etc/traefik/cert-{{ $e }}.pem"
|
- certFile: "/etc/traefik/cert-{{ $e }}.pem"
|
||||||
keyFile: "/etc/traefik/cert-{{ $e }}.key"
|
keyFile: "/etc/traefik/cert-{{ $e }}.key"
|
||||||
store:
|
store:
|
||||||
|
|
Loading…
Reference in a new issue