Restrict traefik.toml to static configuration.

This commit is contained in:
Ludovic Fernandez 2019-07-15 10:22:03 +02:00 committed by Traefiker Bot
parent f49800e56a
commit 093658836e
78 changed files with 274 additions and 440 deletions

View file

@ -81,9 +81,6 @@ labels:
```toml tab="File"
# As Toml Configuration File
[providers]
[providers.file]
[http.routers]
[http.routers.router1]
service = "myService"
@ -128,9 +125,6 @@ and therefore this specification would be ignored even if present.
Declaring the add-foo-prefix in the file provider.
```toml
[providers]
[providers.file]
[http.middlewares]
[http.middlewares.add-foo-prefix.addPrefix]
prefix = "/foo"

View file

@ -6,7 +6,6 @@ Good Old Configuration File
The file provider lets you define the [dynamic configuration](./overview.md) in a TOML or YAML file.
You can write these configuration elements:
* At the end of the main Traefik configuration file (by default: `traefik.toml`/`traefik.yml`/`traefik.yaml`).
* In [a dedicated file](#filename)
* In [several dedicated files](#directory)
@ -22,13 +21,19 @@ You can write these configuration elements:
Enabling the file provider:
```toml tab="TOML"
```toml tab="File (TOML)"
[providers.file]
filename = "/my/path/to/dynamic-conf.toml"
```
```yaml tab="YAML"
```yaml tab="File (YAML)"
providers:
file: {}
file:
filename: "/my/path/to/dynamic-conf.yml"
```
```bash tab="CLI"
--providers.file.filename=/my/path/to/dynamic_conf.toml
```
Declaring Routers, Middlewares & Services:
@ -102,16 +107,20 @@ _Optional_
Defines the path of the configuration file.
```toml tab="TOML"
```toml tab="File (TOML)"
[providers]
[providers.file]
filename = "rules.toml"
filename = "dynamic_conf.toml"
```
```yaml tab="YAML"
```yaml tab="File (YAML)"
providers:
file:
filename: rules.yaml
filename: dynamic_conf.yml
```
```bash tab="CLI"
--providers.file.filename=dynamic_conf.toml
```
### `directory`
@ -120,18 +129,22 @@ _Optional_
Defines the directory that contains the configuration files.
```toml tab="TOML"
```toml tab="File (TOML)"
[providers]
[providers.file]
directory = "/path/to/config"
```
```yaml tab="YAML"
```yaml tab="File (YAML)"
providers:
file:
directory: /path/to/config
```
```bash tab="CLI"
--providers.file.directory=/path/to/config
```
### `watch`
_Optional_
@ -139,20 +152,25 @@ _Optional_
Set the `watch` option to `true` to allow Traefik to automatically watch for file changes.
It works with both the `filename` and the `directory` options.
```toml tab="TOML"
```toml tab="File (TOML)"
[providers]
[providers.file]
filename = "rules.toml"
filename = "dynamic_conf.toml"
watch = true
```
```yaml tab="YAML"
```yaml tab="File (YAML)"
providers:
file:
filename: rules.yml
filename: dynamic_conf.yml
watch: true
```
```bash tab="CLI"
--providers.file.filename=dynamic_conf.toml
--providers.file.watch=true
```
### Go Templating
!!! warning

View file

@ -285,9 +285,6 @@ Use the ip address from the bound port, rather than from the inner network. (Def
`--providers.docker.watch`:
Watch provider. (Default: ```true```)
`--providers.file`:
Enable File backend with default settings. (Default: ```false```)
`--providers.file.debugloggeneratedtemplate`:
Enable debug logging of generated configuration template. (Default: ```false```)

View file

@ -285,9 +285,6 @@ Use the ip address from the bound port, rather than from the inner network. (Def
`TRAEFIK_PROVIDERS_DOCKER_WATCH`:
Watch provider. (Default: ```true```)
`TRAEFIK_PROVIDERS_FILE`:
Enable File backend with default settings. (Default: ```false```)
`TRAEFIK_PROVIDERS_FILE_DEBUGLOGGENERATEDTEMPLATE`:
Enable debug logging of generated configuration template. (Default: ```false```)

View file

@ -35,6 +35,7 @@ Static configuration:
[providers]
# Enable the file provider to define routers / middlewares / services in a file
[providers.file]
filename = "dynamic_conf.toml"
```
```yaml tab="File (YAML)"
@ -45,7 +46,8 @@ entryPoints:
providers:
# Enable the file provider to define routers / middlewares / services in a file
file: {}
file:
filename: dynamic_conf.yml
```
```bash tab="CLI"
@ -53,7 +55,7 @@ providers:
--entryPoints.web.address=:8081
# Enable the file provider to define routers / middlewares / services in a file
--providers.file
--providers.file.filename=dynamic_conf.toml
```
Dynamic configuration:
@ -124,7 +126,7 @@ http:
Static configuration:
```toml tab="TOML"
```toml tab="File (TOML)"
[entryPoints]
[entryPoints.web]
# Listen on port 8081 for incoming requests
@ -133,16 +135,18 @@ http:
[providers]
# Enable the file provider to define routers / middlewares / services in a file
[providers.file]
filename = "dynamic_conf.toml"
```
```yaml tab="YAML"
```yaml tab="File (YAML)"
entryPoints:
web:
# Listen on port 8081 for incoming requests
address: :8081
providers:
# Enable the file provider to define routers / middlewares / services in a file
file: {}
file:
filename: dynamic_conf.yml
```
```bash tab="CLI"
@ -150,7 +154,7 @@ http:
--entryPoints.web.address=":8081"
# Enable the file provider to define routers / middlewares / services in a file
--providers.file
--providers.file.filename=dynamic_conf.toml
```
Dynamic configuration:

View file

@ -6,17 +6,40 @@ This section explains how to use Traefik as reverse proxy for gRPC application.
### Traefik Configuration
```toml tab="TOML"
## static configuration ##
Static configuration:
```toml tab="File (TOML)"
[entryPoints]
[entryPoints.http]
[entryPoints.web]
address = ":80"
[api]
[providers.file]
filename = "dynamic_conf.toml"
```
```yaml tab="File (YAML)"
entryPoints:
web:
address: :80
providers:
file:
filename: dynamic_conf.yml
api: {}
```
```yaml tab="CLI"
--entryPoints.web.address=":80"
--providers.file.filename=dynamic_conf.toml
--api
```
`dynamic_conf.{toml,yml}`:
```toml tab="TOML"
## dynamic configuration ##
[http]
@ -34,17 +57,6 @@ This section explains how to use Traefik as reverse proxy for gRPC application.
```
```yaml tab="YAML"
## static configuration ##
entryPoints:
http:
address: :80
providers:
file: {}
api: {}
## dynamic configuration ##
http:
@ -105,11 +117,11 @@ Common Name (e.g. server FQDN or YOUR name) []: frontend.local
At last, we configure our Traefik instance to use both self-signed certificates.
```toml tab="TOML"
## static configuration ##
Static configuration:
```toml tab="File (TOML)"
[entryPoints]
[entryPoints.https]
[entryPoints.websecure]
address = ":4443"
@ -120,7 +132,37 @@ At last, we configure our Traefik instance to use both self-signed certificates.
[api]
[provider.file]
filename = "dynamic_conf.toml"
```
```yaml tab="File (YAML)"
entryPoints:
websecure:
address: :4443
serversTransport:
# For secure connection on backend.local
rootCAs:
- ./backend.cert
providers:
file:
filename: dynamic_conf.yml
api: {}
```
```yaml tab="CLI"
--entryPoints.websecure.address=":4443"
# For secure connection on backend.local
--serversTransport.rootCAs=./backend.cert
--providers.file.filename=dynamic_conf.toml
--api
```
`dynamic_conf.{toml,yml}`:
```toml tab="TOML"
## dynamic configuration ##
[http]
@ -146,22 +188,6 @@ At last, we configure our Traefik instance to use both self-signed certificates.
```
```yaml tab="YAML"
## static configuration ##
entryPoints:
https:
address: :4443
serversTransport:
# For secure connection on backend.local
rootCAs:
- ./backend.cert
providers:
file: {}
api: {}
## dynamic configuration ##
http: