diff --git a/docs/content/reference/routing-configuration/other-providers/file.md b/docs/content/reference/routing-configuration/other-providers/file.md index 58dd5b2fc..e4b793499 100644 --- a/docs/content/reference/routing-configuration/other-providers/file.md +++ b/docs/content/reference/routing-configuration/other-providers/file.md @@ -1,26 +1,454 @@ --- -title: "Traefik File Dynamic Configuration" -description: "This guide will provide you with the YAML and TOML files for dynamic configuration in Traefik Proxy. Read the technical documentation." +title: "Traefik File Routing Configuration" +description: "This guide will provide you with the reference for file-based routing configuration in Traefik Proxy. Read the technical documentation." --- +# Traefik File Routing Configuration -# Traefik and Configuration Files +The file provider lets you define routing configuration in YAML or TOML. +Use it to declare routers, services, middlewares, TCP and UDP routing, and TLS options that Traefik should load from a file or a directory. -!!! warning "Work In Progress" +To configure the file provider itself, see the [File provider install configuration](../../install-configuration/providers/others/file.md) page. - This page is still work in progress to provide a better documention of the routing options. +## Configuration Examples - It has been created to provide a centralized page with all the option in YAML and TOML format. +??? example "Configuring the File Provider and Exposing One HTTP Service" + + Enabling the file provider: + + ```yaml tab="Structured (YAML)" + providers: + file: + filename: /etc/traefik/dynamic.yml + ``` + + ```toml tab="Structured (TOML)" + [providers.file] + filename = "/etc/traefik/dynamic.toml" + ``` + + ```bash tab="CLI" + --providers.file.filename=/etc/traefik/dynamic.yml + ``` + + Declaring the dynamic HTTP configuration: + + ```yaml tab="Structured (YAML)" + http: + routers: + app: + rule: Host(`example.com`) + entryPoints: + - websecure + service: app + tls: {} + + services: + app: + loadBalancer: + servers: + - url: http://127.0.0.1:8080 + ``` + + ```toml tab="Structured (TOML)" + [http.routers.app] + rule = "Host(`example.com`)" + entryPoints = ["websecure"] + service = "app" + + [http.routers.app.tls] + + [http.services.app.loadBalancer] + [[http.services.app.loadBalancer.servers]] + url = "http://127.0.0.1:8080" + ``` + +??? example "Specifying More Than One Router and Service" + + Define each router and explicitly attach it to the service that should handle matching requests. + + ```yaml tab="Structured (YAML)" + http: + routers: + app: + rule: Host(`example-a.com`) + service: app + admin: + rule: Host(`example-b.com`) + service: admin + + services: + app: + loadBalancer: + servers: + - url: http://127.0.0.1:8000 + admin: + loadBalancer: + servers: + - url: http://127.0.0.1:9000 + ``` + + ```toml tab="Structured (TOML)" + [http.routers.app] + rule = "Host(`example-a.com`)" + service = "app" + + [http.routers.admin] + rule = "Host(`example-b.com`)" + service = "admin" + + [http.services.app.loadBalancer] + [[http.services.app.loadBalancer.servers]] + url = "http://127.0.0.1:8000" + + [http.services.admin.loadBalancer] + [[http.services.admin.loadBalancer.servers]] + url = "http://127.0.0.1:9000" + ``` + +??? example "Declaring and Referencing Middlewares" + + Middlewares declared by the file provider can be used by routers from the file provider or by routers from other providers. + When another provider references them, use the `@file` provider suffix. + + ```yaml tab="Structured (YAML)" + http: + routers: + app: + rule: Host(`secure.example.com`) + entryPoints: + - websecure + middlewares: + - secure-headers + service: app + tls: + options: modern + + middlewares: + secure-headers: + headers: + stsSeconds: 31536000 + forceSTSHeader: true + + services: + app: + loadBalancer: + servers: + - url: http://127.0.0.1:8080 + + tls: + options: + modern: + minVersion: VersionTLS12 + sniStrict: true + ``` + + ```toml tab="Structured (TOML)" + [http.routers.app] + rule = "Host(`secure.example.com`)" + entryPoints = ["websecure"] + middlewares = ["secure-headers"] + service = "app" + + [http.routers.app.tls] + options = "modern" + + [http.middlewares.secure-headers.headers] + stsSeconds = 31536000 + forceSTSHeader = true + + [http.services.app.loadBalancer] + [[http.services.app.loadBalancer.servers]] + url = "http://127.0.0.1:8080" + + [tls.options.modern] + minVersion = "VersionTLS12" + sniStrict = true + ``` + +??? example "Loading Multiple Dynamic Configuration Files" + + Configure the file provider with a directory when you want to split dynamic configuration across multiple files. + + ```yaml tab="Structured (YAML)" + providers: + file: + directory: /etc/traefik/dynamic + watch: true + ``` + + ```toml tab="Structured (TOML)" + [providers.file] + directory = "/etc/traefik/dynamic" + watch = true + ``` + + ```bash tab="CLI" + --providers.file.directory=/etc/traefik/dynamic + --providers.file.watch=true + ``` + + Example `/etc/traefik/dynamic/http.yml`: + + ```yaml + http: + routers: + app: + rule: Host(`example.com`) + service: app + + services: + app: + loadBalancer: + servers: + - url: http://127.0.0.1:8080 + ``` + + Example `/etc/traefik/dynamic/tls.yml`: + + ```yaml + tls: + certificates: + - certFile: /certs/example.crt + keyFile: /certs/example.key + ``` ## Configuration Options -```yml tab="YAML" ---8<-- "content/reference/routing-configuration/other-providers/file.yaml" -``` +### General -```toml tab="TOML" ---8<-- "content/reference/routing-configuration/other-providers/file.toml" -``` +The file provider does not discover services automatically. +Define every router, service, middleware, and TLS resource explicitly in the routing configuration file. + +When another provider references a resource declared by the file provider, append the `@file` provider suffix. +For example, a Docker label can reference a file-provider middleware with `secure-headers@file`. + +The examples below use YAML-style field paths. +In TOML, use the equivalent table and array syntax, such as `[http.routers.]` and `[[http.services..loadBalancer.servers]]`. + +### HTTP + +#### Routers + +Define HTTP routers under `http.routers.`. + +!!! warning "The character `@` is not authorized in the router name ``." + +| Field | Description | Value | +|------|-------------|-------| +| `http.routers..rule` | See [rule](../http/routing/rules-and-priority.md#rules) for more information. | ```Host(`example.com`)``` | +| `http.routers..ruleSyntax` | See [ruleSyntax](../http/routing/rules-and-priority.md#rulesyntax) for more information.
RuleSyntax is deprecated and will be removed in the next major version. | `v3` | +| `http.routers..entryPoints[n]` | See [entry points](../../install-configuration/entrypoints.md) for more information. | `websecure` | +| `http.routers..middlewares[n]` | See [middlewares overview](../http/middlewares/overview.md) for more information. | `secure-headers` | +| `http.routers..service` | See [service](../http/load-balancing/service.md) for more information. | `app` | +| `http.routers..parentRefs[n]` | See [multi-layer routing](../http/routing/multi-layer-routing.md) for more information. | `parent-router@file` | +| `http.routers..tls` | See [TLS](../http/tls/overview.md) for more information. | `{}` | +| `http.routers..tls.certResolver` | See [certResolver](../../install-configuration/tls/certificate-resolvers/overview.md) for more information. | `myresolver` | +| `http.routers..tls.domains[n].main` | See [domains](../../install-configuration/tls/certificate-resolvers/acme.md#domain-definition) for more information. | `example.org` | +| `http.routers..tls.domains[n].sans[n]` | See [domains](../../install-configuration/tls/certificate-resolvers/acme.md#domain-definition) for more information. | `www.example.org` | +| `http.routers..tls.options` | See [TLS options](../http/tls/tls-options.md) for more information. | `modern` | +| `http.routers..observability.accessLogs` | Enables or disables access logs for the router. | `true` | +| `http.routers..observability.metrics` | Enables or disables metrics for the router. | `true` | +| `http.routers..observability.tracing` | Enables or disables tracing for the router. | `true` | +| `http.routers..observability.traceVerbosity` | See [trace verbosity](../http/routing/observability.md#opt-traceVerbosity) for more information. | `minimal` | +| `http.routers..priority` | See [priority](../http/routing/rules-and-priority.md#priority-calculation) for more information. | `42` | + +#### Services + +Define HTTP services under `http.services.`. + +!!! warning "The character `@` is not authorized in the service name ``." + +| Field | Description | Value | +|------|-------------|-------| +| `http.services..loadBalancer.servers[n].url` | See [servers](../http/load-balancing/service.md#servers) for more information. | `http://127.0.0.1:8080` | +| `http.services..loadBalancer.servers[n].weight` | See [servers](../http/load-balancing/service.md#servers) for more information. | `1` | +| `http.services..loadBalancer.servers[n].preservePath` | See [servers](../http/load-balancing/service.md#servers) for more information. | `true` | +| `http.services..loadBalancer.strategy` | See [load balancing strategies](../http/load-balancing/service.md#load-balancing-strategies) for more information. | `wrr` | +| `http.services..loadBalancer.passHostHeader` | See [service load balancer](../http/load-balancing/service.md) for more information. | `true` | +| `http.services..loadBalancer.healthCheck.*` | See [health check](../http/load-balancing/service.md#health-check) for more information. | `path: /health` | +| `http.services..loadBalancer.passiveHealthCheck.*` | See [passive health check](../http/load-balancing/service.md#passive-health-check) for more information. | `maxFailedAttempts: 3` | +| `http.services..loadBalancer.sticky.cookie.*` | See [sticky sessions](../http/load-balancing/service.md#sticky-sessions) for more information. | `name: app-cookie` | +| `http.services..loadBalancer.responseForwarding.flushInterval` | See [service load balancer](../http/load-balancing/service.md) for more information. | `100ms` | +| `http.services..loadBalancer.serversTransport` | See [ServersTransport](../http/load-balancing/serverstransport.md) for more information. | `secure-transport` | +| `http.services..weighted.services[n].name` | See [weighted round robin](../http/load-balancing/service.md#weighted-round-robin-wrr) for more information. | `app-v1` | +| `http.services..weighted.services[n].weight` | See [weighted round robin](../http/load-balancing/service.md#weighted-round-robin-wrr) for more information. | `3` | +| `http.services..weighted.sticky.cookie.*` | See [sticky sessions](../http/load-balancing/service.md#sticky-sessions) for more information. | `name: app-cookie` | +| `http.services..weighted.healthCheck` | See [weighted service health check](../http/load-balancing/service.md#health-check) for more information. | `{}` | +| `http.services..highestRandomWeight.services[n].name` | See [highest random weight](../http/load-balancing/service.md#highest-random-weight) for more information. | `app-v1` | +| `http.services..highestRandomWeight.services[n].weight` | See [highest random weight](../http/load-balancing/service.md#highest-random-weight) for more information. | `3` | +| `http.services..highestRandomWeight.healthCheck` | See [highest random weight](../http/load-balancing/service.md#highest-random-weight) for more information. | `{}` | +| `http.services..mirroring.service` | See [mirroring](../http/load-balancing/service.md#mirroring) for more information. | `app-main` | +| `http.services..mirroring.mirrorBody` | See [mirroring](../http/load-balancing/service.md#mirroring) for more information. | `true` | +| `http.services..mirroring.maxBodySize` | See [mirroring](../http/load-balancing/service.md#mirroring) for more information. | `1048576` | +| `http.services..mirroring.mirrors[n].name` | See [mirroring](../http/load-balancing/service.md#mirroring) for more information. | `app-shadow` | +| `http.services..mirroring.mirrors[n].percent` | See [mirroring](../http/load-balancing/service.md#mirroring) for more information. | `10` | +| `http.services..mirroring.healthCheck` | See [mirroring](../http/load-balancing/service.md#mirroring) for more information. | `{}` | +| `http.services..failover.service` | See [failover](../http/load-balancing/service.md#failover) for more information. | `app-main` | +| `http.services..failover.fallback` | See [failover](../http/load-balancing/service.md#failover) for more information. | `app-backup` | +| `http.services..failover.healthCheck` | See [failover](../http/load-balancing/service.md#failover) for more information. | `{}` | +| `http.services..failover.errors.maxRequestBodyBytes` | See [failover errors](../http/load-balancing/service.md#errors) for more information. | `1048576` | +| `http.services..failover.errors.status[n]` | See [failover errors](../http/load-balancing/service.md#errors) for more information. | `500-599` | +| `http.services..middlewares[n]` | Adds middlewares to the service. | `service-ratelimit` | + +#### Middlewares + +Define HTTP middlewares under `http.middlewares.`. + +For example, to declare an [`AddPrefix`](../http/middlewares/addprefix.md) middleware named `add-api`, set `http.middlewares.add-api.addPrefix.prefix=/api`. + +More information about available middlewares can be found in the dedicated [middlewares section](../http/middlewares/overview.md). + +!!! warning "The character `@` is not authorized in the middleware name ``." + +!!! warning "Conflicts in Declaration" + + If you declare multiple middlewares with the same name but different parameters, the middleware fails to be declared. + +| Field | Description | Value | +|------|-------------|-------| +| `http.middlewares...` | With `middleware_type` the middleware type, such as `addPrefix` or `headers`, and `middleware_option` the option to set. | `prefix: /api` | + +#### ServersTransports + +Define HTTP ServersTransports under `http.serversTransports.`. + +| Field | Description | Value | +|------|-------------|-------| +| `http.serversTransports..*` | See [ServersTransport](../http/load-balancing/serverstransport.md) for more information. | `serverName: example.org` | + +### TCP + +You can declare TCP routers, services, middlewares, and ServersTransports with the file provider. + +#### TCP Routers + +Define TCP routers under `tcp.routers.`. + +!!! warning "The character `@` is not authorized in the router name ``." + +| Field | Description | Value | +|------|-------------|-------| +| `tcp.routers..entryPoints[n]` | See [entry points](../../install-configuration/entrypoints.md) for more information. | `websecure` | +| `tcp.routers..rule` | See [rule](../tcp/routing/rules-and-priority.md#rules) for more information. | ```HostSNI(`example.com`)``` | +| `tcp.routers..ruleSyntax` | Configures the rule syntax to use for parsing the rule on a per-router basis.
RuleSyntax is deprecated and will be removed in the next major version. | `v3` | +| `tcp.routers..middlewares[n]` | See [TCP middlewares overview](../tcp/middlewares/overview.md) for more information. | `ip-allowlist` | +| `tcp.routers..service` | See [service](../tcp/service.md) for more information. | `tcp-app` | +| `tcp.routers..tls` | See [TLS](../tcp/tls.md) for more information. | `{}` | +| `tcp.routers..tls.certResolver` | See [certResolver](../tcp/tls.md#configuration-options) for more information. | `myresolver` | +| `tcp.routers..tls.domains[n].main` | See [TLS](../tcp/tls.md) for more information. | `example.org` | +| `tcp.routers..tls.domains[n].sans[n]` | See [TLS](../tcp/tls.md) for more information. | `www.example.org` | +| `tcp.routers..tls.options` | See [TLS](../tcp/tls.md) for more information. | `modern` | +| `tcp.routers..tls.passthrough` | See [Passthrough](../tcp/tls.md#opt-passthrough) for more information. | `true` | +| `tcp.routers..priority` | See [priority](../tcp/routing/rules-and-priority.md#priority-calculation) for more information. | `42` | + +#### TCP Services + +Define TCP services under `tcp.services.`. + +!!! warning "The character `@` is not authorized in the service name ``." + +| Field | Description | Value | +|------|-------------|-------| +| `tcp.services..loadBalancer.servers[n].address` | See [servers load balancer](../tcp/service.md#servers-load-balancer) for more information. | `127.0.0.1:9000` | +| `tcp.services..loadBalancer.servers[n].tls` | Determines whether to use TLS when dialing the backend server. | `true` | +| `tcp.services..loadBalancer.serversTransport` | See [TCP ServersTransport](../tcp/serverstransport.md) for more information. | `secure-tcp` | +| `tcp.services..loadBalancer.proxyProtocol.version` | Enables Proxy Protocol for backend connections. | `2` | +| `tcp.services..loadBalancer.terminationDelay` | Defines the delay before terminating connections. | `100` | +| `tcp.services..loadBalancer.healthCheck.*` | See [TCP service health check](../tcp/service.md#health-check) for more information. | `interval: 10s` | +| `tcp.services..weighted.services[n].name` | See [weighted round robin](../tcp/service.md#weighted-round-robin) for more information. | `tcp-v1` | +| `tcp.services..weighted.services[n].weight` | See [weighted round robin](../tcp/service.md#weighted-round-robin) for more information. | `3` | +| `tcp.services..weighted.healthCheck` | See [weighted round robin](../tcp/service.md#weighted-round-robin) for more information. | `{}` | + +#### TCP Middlewares + +Define TCP middlewares under `tcp.middlewares.`. + +For example, to declare an [`InFlightConn`](../tcp/middlewares/inflightconn.md) middleware named `limit`, set `tcp.middlewares.limit.inFlightConn.amount=10`. + +More information about available middlewares is available in the dedicated [TCP middlewares section](../tcp/middlewares/overview.md). + +!!! warning "The character `@` is not authorized in the middleware name ``." + +!!! warning "Conflicts in Declaration" + + If you declare multiple middlewares with the same name but different parameters, the middleware fails to be declared. + +| Field | Description | Value | +|------|-------------|-------| +| `tcp.middlewares...` | With `middleware_type` the middleware type, such as `inFlightConn`, and `middleware_option` the option to set. | `amount: 10` | + +#### TCP ServersTransports + +Define TCP ServersTransports under `tcp.serversTransports.`. + +| Field | Description | Value | +|------|-------------|-------| +| `tcp.serversTransports..*` | See [TCP ServersTransport](../tcp/serverstransport.md) for more information. | `dialTimeout: 30s` | + +### UDP + +You can declare UDP routers and services with the file provider. + +#### UDP Routers + +Define UDP routers under `udp.routers.`. + +!!! warning "The character `@` is not authorized in the router name ``." + +| Field | Description | Value | +|------|-------------|-------| +| `udp.routers..entryPoints[n]` | See [UDP router entrypoints](../udp/routing/rules-priority.md#entrypoints) for more information. | `dns` | +| `udp.routers..service` | See [UDP router configuration](../udp/routing/rules-priority.md#configuration-example) for more information. | `dns-service` | + +#### UDP Services + +Define UDP services under `udp.services.`. + +!!! warning "The character `@` is not authorized in the service name ``." + +| Field | Description | Value | +|------|-------------|-------| +| `udp.services..loadBalancer.servers[n].address` | See [UDP service](../udp/service.md) for more information. | `127.0.0.1:5353` | +| `udp.services..weighted.services[n].name` | See [UDP service](../udp/service.md) for more information. | `dns-v1` | +| `udp.services..weighted.services[n].weight` | See [UDP service](../udp/service.md) for more information. | `3` | + +### TLS + +You can declare TLS certificates, options, and stores with the file provider. + +#### Certificates + +| Field | Description | Value | +|------|-------------|-------| +| `tls.certificates[n].certFile` | See [TLS certificates](../http/tls/tls-certificates.md) for more information. | `/certs/example.crt` | +| `tls.certificates[n].keyFile` | See [TLS certificates](../http/tls/tls-certificates.md) for more information. | `/certs/example.key` | +| `tls.certificates[n].stores[n]` | See [certificate stores](../http/tls/tls-certificates.md#certificates-stores) for more information. | `default` | + +#### TLS Options + +| Field | Description | Value | +|------|-------------|-------| +| `tls.options..minVersion` | See [TLS options](../http/tls/tls-options.md) for more information. | `VersionTLS12` | +| `tls.options..maxVersion` | See [TLS options](../http/tls/tls-options.md) for more information. | `VersionTLS13` | +| `tls.options..cipherSuites[n]` | See [TLS options](../http/tls/tls-options.md) for more information. | `TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256` | +| `tls.options..curvePreferences[n]` | See [TLS options](../http/tls/tls-options.md) for more information. | `CurveP256` | +| `tls.options..clientAuth.caFiles[n]` | See [client authentication](../http/tls/tls-options.md#client-authentication-mtls) for more information. | `/certs/client-ca.crt` | +| `tls.options..clientAuth.clientAuthType` | See [client authentication](../http/tls/tls-options.md#client-authentication-mtls) for more information. | `RequireAndVerifyClientCert` | +| `tls.options..sniStrict` | See [strict SNI checking](../http/tls/tls-options.md#strict-sni-checking) for more information. | `true` | +| `tls.options..alpnProtocols[n]` | See [TLS options](../http/tls/tls-options.md) for more information. | `h2` | +| `tls.options..disableSessionTickets` | See [TLS options](../http/tls/tls-options.md) for more information. | `true` | +| `tls.options..preferServerCipherSuites` | See [TLS options](../http/tls/tls-options.md) for more information. | `true` | + +#### TLS Stores + +| Field | Description | Value | +|------|-------------|-------| +| `tls.stores..defaultCertificate.certFile` | See [default certificate](../http/tls/tls-certificates.md#default-certificate) for more information. | `/certs/default.crt` | +| `tls.stores..defaultCertificate.keyFile` | See [default certificate](../http/tls/tls-certificates.md#default-certificate) for more information. | `/certs/default.key` | +| `tls.stores..defaultGeneratedCert.resolver` | See [ACME default certificate](../http/tls/tls-certificates.md#acme-default-certificate) for more information. | `myresolver` | +| `tls.stores..defaultGeneratedCert.domain.main` | See [ACME default certificate](../http/tls/tls-certificates.md#acme-default-certificate) for more information. | `example.org` | +| `tls.stores..defaultGeneratedCert.domain.sans[n]` | See [ACME default certificate](../http/tls/tls-certificates.md#acme-default-certificate) for more information. | `www.example.org` | ## Go Templating @@ -69,7 +497,7 @@ To illustrate, it is possible to easily define multiple routers, services, and T {{ range $i, $e := until 10 }} - certFile: "/etc/traefik/cert-{{ $e }}.pem" keyFile: "/etc/traefik/cert-{{ $e }}.key" - store: + stores: - "my-store-foo-{{ $e }}" - "my-store-bar-{{ $e }}" {{end}} @@ -101,7 +529,7 @@ To illustrate, it is possible to easily define multiple routers, services, and T [tcp.services] {{ range $i, $e := until 100 }} - [http.services.service{{ $e }}] + [tcp.services.service{{ $e }}] # ... {{ end }} @@ -112,9 +540,9 @@ To illustrate, it is possible to easily define multiple routers, services, and T stores = ["my-store-foo-{{ $e }}", "my-store-bar-{{ $e }}"] {{ end }} - [tls.config] + [tls.options] {{ range $i, $e := until 10 }} - [tls.config.TLS{{ $e }}] + [tls.options.TLS{{ $e }}] # ... {{ end }} ``` diff --git a/docs/content/reference/routing-configuration/other-providers/file.toml b/docs/content/reference/routing-configuration/other-providers/file.toml deleted file mode 100644 index e02b09a30..000000000 --- a/docs/content/reference/routing-configuration/other-providers/file.toml +++ /dev/null @@ -1,641 +0,0 @@ -## CODE GENERATED AUTOMATICALLY -## THIS FILE MUST NOT BE EDITED BY HAND -[http] - [http.routers] - [http.routers.Router0] - entryPoints = ["foobar", "foobar"] - middlewares = ["foobar", "foobar"] - service = "foobar" - rule = "foobar" - parentRefs = ["foobar", "foobar"] - ruleSyntax = "foobar" - priority = 42 - [http.routers.Router0.tls] - options = "foobar" - certResolver = "foobar" - - [[http.routers.Router0.tls.domains]] - main = "foobar" - sans = ["foobar", "foobar"] - - [[http.routers.Router0.tls.domains]] - main = "foobar" - sans = ["foobar", "foobar"] - [http.routers.Router0.observability] - accessLogs = true - metrics = true - tracing = true - traceVerbosity = "foobar" - [http.routers.Router1] - entryPoints = ["foobar", "foobar"] - middlewares = ["foobar", "foobar"] - service = "foobar" - rule = "foobar" - parentRefs = ["foobar", "foobar"] - ruleSyntax = "foobar" - priority = 42 - [http.routers.Router1.tls] - options = "foobar" - certResolver = "foobar" - - [[http.routers.Router1.tls.domains]] - main = "foobar" - sans = ["foobar", "foobar"] - - [[http.routers.Router1.tls.domains]] - main = "foobar" - sans = ["foobar", "foobar"] - [http.routers.Router1.observability] - accessLogs = true - metrics = true - tracing = true - traceVerbosity = "foobar" - [http.services] - [http.services.Service01] - [http.services.Service01.failover] - service = "foobar" - fallback = "foobar" - [http.services.Service01.failover.healthCheck] - [http.services.Service02] - [http.services.Service02.highestRandomWeight] - - [[http.services.Service02.highestRandomWeight.services]] - name = "foobar" - weight = 42 - - [[http.services.Service02.highestRandomWeight.services]] - name = "foobar" - weight = 42 - [http.services.Service02.highestRandomWeight.healthCheck] - [http.services.Service03] - [http.services.Service03.loadBalancer] - strategy = "foobar" - passHostHeader = true - serversTransport = "foobar" - [http.services.Service03.loadBalancer.sticky] - [http.services.Service03.loadBalancer.sticky.cookie] - name = "foobar" - secure = true - httpOnly = true - sameSite = "foobar" - maxAge = 42 - path = "foobar" - domain = "foobar" - - [[http.services.Service03.loadBalancer.servers]] - url = "foobar" - weight = 42 - preservePath = true - - [[http.services.Service03.loadBalancer.servers]] - url = "foobar" - weight = 42 - preservePath = true - [http.services.Service03.loadBalancer.healthCheck] - scheme = "foobar" - mode = "foobar" - path = "foobar" - method = "foobar" - status = 42 - port = 42 - interval = "42s" - unhealthyInterval = "42s" - timeout = "42s" - hostname = "foobar" - followRedirects = true - [http.services.Service03.loadBalancer.healthCheck.headers] - name0 = "foobar" - name1 = "foobar" - [http.services.Service03.loadBalancer.passiveHealthCheck] - failureWindow = "42s" - maxFailedAttempts = 42 - [http.services.Service03.loadBalancer.responseForwarding] - flushInterval = "42s" - [http.services.Service04] - [http.services.Service04.mirroring] - service = "foobar" - mirrorBody = true - maxBodySize = 42 - - [[http.services.Service04.mirroring.mirrors]] - name = "foobar" - percent = 42 - - [[http.services.Service04.mirroring.mirrors]] - name = "foobar" - percent = 42 - [http.services.Service04.mirroring.healthCheck] - [http.services.Service05] - [http.services.Service05.weighted] - - [[http.services.Service05.weighted.services]] - name = "foobar" - weight = 42 - - [[http.services.Service05.weighted.services]] - name = "foobar" - weight = 42 - [http.services.Service05.weighted.sticky] - [http.services.Service05.weighted.sticky.cookie] - name = "foobar" - secure = true - httpOnly = true - sameSite = "foobar" - maxAge = 42 - path = "foobar" - domain = "foobar" - [http.services.Service05.weighted.healthCheck] - [http.middlewares] - [http.middlewares.Middleware01] - [http.middlewares.Middleware01.addPrefix] - prefix = "foobar" - [http.middlewares.Middleware02] - [http.middlewares.Middleware02.basicAuth] - users = ["foobar", "foobar"] - usersFile = "foobar" - realm = "foobar" - removeHeader = true - headerField = "foobar" - [http.middlewares.Middleware03] - [http.middlewares.Middleware03.buffering] - maxRequestBodyBytes = 42 - memRequestBodyBytes = 42 - maxResponseBodyBytes = 42 - memResponseBodyBytes = 42 - retryExpression = "foobar" - [http.middlewares.Middleware04] - [http.middlewares.Middleware04.chain] - middlewares = ["foobar", "foobar"] - [http.middlewares.Middleware05] - [http.middlewares.Middleware05.circuitBreaker] - expression = "foobar" - checkPeriod = "42s" - fallbackDuration = "42s" - recoveryDuration = "42s" - responseCode = 42 - [http.middlewares.Middleware06] - [http.middlewares.Middleware06.compress] - excludedContentTypes = ["foobar", "foobar"] - includedContentTypes = ["foobar", "foobar"] - minResponseBodyBytes = 42 - encodings = ["foobar", "foobar"] - defaultEncoding = "foobar" - [http.middlewares.Middleware07] - [http.middlewares.Middleware07.contentType] - autoDetect = true - [http.middlewares.Middleware08] - [http.middlewares.Middleware08.digestAuth] - users = ["foobar", "foobar"] - usersFile = "foobar" - removeHeader = true - realm = "foobar" - headerField = "foobar" - [http.middlewares.Middleware09] - [http.middlewares.Middleware09.errors] - status = ["foobar", "foobar"] - service = "foobar" - query = "foobar" - errorRequestHeaders = ["foobar", "foobar"] - [http.middlewares.Middleware09.errors.statusRewrites] - name0 = 42 - name1 = 42 - [http.middlewares.Middleware10] - [http.middlewares.Middleware10.forwardAuth] - address = "foobar" - trustForwardHeader = true - authResponseHeaders = ["foobar", "foobar"] - authResponseHeadersRegex = "foobar" - authRequestHeaders = ["foobar", "foobar"] - maxResponseBodySize = 42 - addAuthCookiesToResponse = ["foobar", "foobar"] - headerField = "foobar" - forwardBody = true - maxBodySize = 42 - preserveLocationHeader = true - preserveRequestMethod = true - [http.middlewares.Middleware10.forwardAuth.tls] - ca = "foobar" - cert = "foobar" - key = "foobar" - insecureSkipVerify = true - caOptional = true - [http.middlewares.Middleware11] - [http.middlewares.Middleware11.grpcWeb] - allowOrigins = ["foobar", "foobar"] - [http.middlewares.Middleware12] - [http.middlewares.Middleware12.headers] - accessControlAllowCredentials = true - accessControlAllowHeaders = ["foobar", "foobar"] - accessControlAllowMethods = ["foobar", "foobar"] - accessControlAllowOriginList = ["foobar", "foobar"] - accessControlAllowOriginListRegex = ["foobar", "foobar"] - accessControlExposeHeaders = ["foobar", "foobar"] - accessControlMaxAge = 42 - addVaryHeader = true - allowedHosts = ["foobar", "foobar"] - hostsProxyHeaders = ["foobar", "foobar"] - stsSeconds = 42 - stsIncludeSubdomains = true - stsPreload = true - forceSTSHeader = true - frameDeny = true - customFrameOptionsValue = "foobar" - contentTypeNosniff = true - browserXssFilter = true - customBrowserXSSValue = "foobar" - contentSecurityPolicy = "foobar" - contentSecurityPolicyReportOnly = "foobar" - publicKey = "foobar" - referrerPolicy = "foobar" - permissionsPolicy = "foobar" - isDevelopment = true - featurePolicy = "foobar" - sslRedirect = true - sslTemporaryRedirect = true - sslHost = "foobar" - sslForceHost = true - [http.middlewares.Middleware12.headers.customRequestHeaders] - name0 = "foobar" - name1 = "foobar" - [http.middlewares.Middleware12.headers.customResponseHeaders] - name0 = "foobar" - name1 = "foobar" - [http.middlewares.Middleware12.headers.sslProxyHeaders] - name0 = "foobar" - name1 = "foobar" - [http.middlewares.Middleware13] - [http.middlewares.Middleware13.ipAllowList] - sourceRange = ["foobar", "foobar"] - rejectStatusCode = 42 - [http.middlewares.Middleware13.ipAllowList.ipStrategy] - depth = 42 - excludedIPs = ["foobar", "foobar"] - ipv6Subnet = 42 - [http.middlewares.Middleware14] - [http.middlewares.Middleware14.ipWhiteList] - sourceRange = ["foobar", "foobar"] - [http.middlewares.Middleware14.ipWhiteList.ipStrategy] - depth = 42 - excludedIPs = ["foobar", "foobar"] - ipv6Subnet = 42 - [http.middlewares.Middleware15] - [http.middlewares.Middleware15.inFlightReq] - amount = 42 - [http.middlewares.Middleware15.inFlightReq.sourceCriterion] - requestHeaderName = "foobar" - requestHost = true - [http.middlewares.Middleware15.inFlightReq.sourceCriterion.ipStrategy] - depth = 42 - excludedIPs = ["foobar", "foobar"] - ipv6Subnet = 42 - [http.middlewares.Middleware16] - [http.middlewares.Middleware16.passTLSClientCert] - pem = true - [http.middlewares.Middleware16.passTLSClientCert.info] - notAfter = true - notBefore = true - sans = true - serialNumber = true - [http.middlewares.Middleware16.passTLSClientCert.info.subject] - country = true - province = true - locality = true - organization = true - organizationalUnit = true - commonName = true - serialNumber = true - domainComponent = true - [http.middlewares.Middleware16.passTLSClientCert.info.issuer] - country = true - province = true - locality = true - organization = true - commonName = true - serialNumber = true - domainComponent = true - [http.middlewares.Middleware17] - [http.middlewares.Middleware17.plugin] - [http.middlewares.Middleware17.plugin.PluginConf0] - name0 = "foobar" - name1 = "foobar" - [http.middlewares.Middleware17.plugin.PluginConf1] - name0 = "foobar" - name1 = "foobar" - [http.middlewares.Middleware18] - [http.middlewares.Middleware18.rateLimit] - average = 42 - period = "42s" - burst = 42 - [http.middlewares.Middleware18.rateLimit.sourceCriterion] - requestHeaderName = "foobar" - requestHost = true - [http.middlewares.Middleware18.rateLimit.sourceCriterion.ipStrategy] - depth = 42 - excludedIPs = ["foobar", "foobar"] - ipv6Subnet = 42 - [http.middlewares.Middleware18.rateLimit.redis] - endpoints = ["foobar", "foobar"] - username = "foobar" - password = "foobar" - db = 42 - poolSize = 42 - minIdleConns = 42 - maxActiveConns = 42 - readTimeout = "42s" - writeTimeout = "42s" - dialTimeout = "42s" - [http.middlewares.Middleware18.rateLimit.redis.tls] - ca = "foobar" - cert = "foobar" - key = "foobar" - insecureSkipVerify = true - [http.middlewares.Middleware19] - [http.middlewares.Middleware19.redirectRegex] - regex = "foobar" - replacement = "foobar" - permanent = true - [http.middlewares.Middleware20] - [http.middlewares.Middleware20.redirectScheme] - scheme = "foobar" - port = "foobar" - permanent = true - [http.middlewares.Middleware21] - [http.middlewares.Middleware21.replacePath] - path = "foobar" - [http.middlewares.Middleware22] - [http.middlewares.Middleware22.replacePathRegex] - regex = "foobar" - replacement = "foobar" - [http.middlewares.Middleware23] - [http.middlewares.Middleware23.retry] - attempts = 42 - initialInterval = "42s" - [http.middlewares.Middleware24] - [http.middlewares.Middleware24.stripPrefix] - prefixes = ["foobar", "foobar"] - forceSlash = true - [http.middlewares.Middleware25] - [http.middlewares.Middleware25.stripPrefixRegex] - regex = ["foobar", "foobar"] - [http.serversTransports] - [http.serversTransports.ServersTransport0] - serverName = "foobar" - insecureSkipVerify = true - rootCAs = ["foobar", "foobar"] - maxIdleConnsPerHost = 42 - disableHTTP2 = true - peerCertURI = "foobar" - - [[http.serversTransports.ServersTransport0.certificates]] - certFile = "foobar" - keyFile = "foobar" - - [[http.serversTransports.ServersTransport0.certificates]] - certFile = "foobar" - keyFile = "foobar" - [http.serversTransports.ServersTransport0.forwardingTimeouts] - dialTimeout = "42s" - responseHeaderTimeout = "42s" - idleConnTimeout = "42s" - readIdleTimeout = "42s" - pingTimeout = "42s" - [http.serversTransports.ServersTransport0.spiffe] - ids = ["foobar", "foobar"] - trustDomain = "foobar" - [http.serversTransports.ServersTransport1] - serverName = "foobar" - insecureSkipVerify = true - rootCAs = ["foobar", "foobar"] - maxIdleConnsPerHost = 42 - disableHTTP2 = true - peerCertURI = "foobar" - - [[http.serversTransports.ServersTransport1.certificates]] - certFile = "foobar" - keyFile = "foobar" - - [[http.serversTransports.ServersTransport1.certificates]] - certFile = "foobar" - keyFile = "foobar" - [http.serversTransports.ServersTransport1.forwardingTimeouts] - dialTimeout = "42s" - responseHeaderTimeout = "42s" - idleConnTimeout = "42s" - readIdleTimeout = "42s" - pingTimeout = "42s" - [http.serversTransports.ServersTransport1.spiffe] - ids = ["foobar", "foobar"] - trustDomain = "foobar" - -[tcp] - [tcp.routers] - [tcp.routers.TCPRouter0] - entryPoints = ["foobar", "foobar"] - middlewares = ["foobar", "foobar"] - service = "foobar" - rule = "foobar" - ruleSyntax = "foobar" - priority = 42 - [tcp.routers.TCPRouter0.tls] - passthrough = true - options = "foobar" - certResolver = "foobar" - - [[tcp.routers.TCPRouter0.tls.domains]] - main = "foobar" - sans = ["foobar", "foobar"] - - [[tcp.routers.TCPRouter0.tls.domains]] - main = "foobar" - sans = ["foobar", "foobar"] - [tcp.routers.TCPRouter1] - entryPoints = ["foobar", "foobar"] - middlewares = ["foobar", "foobar"] - service = "foobar" - rule = "foobar" - ruleSyntax = "foobar" - priority = 42 - [tcp.routers.TCPRouter1.tls] - passthrough = true - options = "foobar" - certResolver = "foobar" - - [[tcp.routers.TCPRouter1.tls.domains]] - main = "foobar" - sans = ["foobar", "foobar"] - - [[tcp.routers.TCPRouter1.tls.domains]] - main = "foobar" - sans = ["foobar", "foobar"] - [tcp.services] - [tcp.services.TCPService01] - [tcp.services.TCPService01.loadBalancer] - serversTransport = "foobar" - terminationDelay = 42 - - [[tcp.services.TCPService01.loadBalancer.servers]] - address = "foobar" - tls = true - - [[tcp.services.TCPService01.loadBalancer.servers]] - address = "foobar" - tls = true - [tcp.services.TCPService01.loadBalancer.proxyProtocol] - version = 42 - [tcp.services.TCPService01.loadBalancer.healthCheck] - port = 42 - send = "foobar" - expect = "foobar" - interval = "42s" - unhealthyInterval = "42s" - timeout = "42s" - [tcp.services.TCPService02] - [tcp.services.TCPService02.weighted] - - [[tcp.services.TCPService02.weighted.services]] - name = "foobar" - weight = 42 - - [[tcp.services.TCPService02.weighted.services]] - name = "foobar" - weight = 42 - [tcp.services.TCPService02.weighted.healthCheck] - [tcp.middlewares] - [tcp.middlewares.TCPMiddleware01] - [tcp.middlewares.TCPMiddleware01.ipAllowList] - sourceRange = ["foobar", "foobar"] - [tcp.middlewares.TCPMiddleware02] - [tcp.middlewares.TCPMiddleware02.ipWhiteList] - sourceRange = ["foobar", "foobar"] - [tcp.middlewares.TCPMiddleware03] - [tcp.middlewares.TCPMiddleware03.inFlightConn] - amount = 42 - [tcp.serversTransports] - [tcp.serversTransports.TCPServersTransport0] - dialKeepAlive = "42s" - dialTimeout = "42s" - terminationDelay = "42s" - [tcp.serversTransports.TCPServersTransport0.proxyProtocol] - version = 42 - [tcp.serversTransports.TCPServersTransport0.tls] - serverName = "foobar" - insecureSkipVerify = true - rootCAs = ["foobar", "foobar"] - peerCertURI = "foobar" - - [[tcp.serversTransports.TCPServersTransport0.tls.certificates]] - certFile = "foobar" - keyFile = "foobar" - - [[tcp.serversTransports.TCPServersTransport0.tls.certificates]] - certFile = "foobar" - keyFile = "foobar" - [tcp.serversTransports.TCPServersTransport0.tls.spiffe] - ids = ["foobar", "foobar"] - trustDomain = "foobar" - [tcp.serversTransports.TCPServersTransport1] - dialKeepAlive = "42s" - dialTimeout = "42s" - terminationDelay = "42s" - [tcp.serversTransports.TCPServersTransport1.proxyProtocol] - version = 42 - [tcp.serversTransports.TCPServersTransport1.tls] - serverName = "foobar" - insecureSkipVerify = true - rootCAs = ["foobar", "foobar"] - peerCertURI = "foobar" - - [[tcp.serversTransports.TCPServersTransport1.tls.certificates]] - certFile = "foobar" - keyFile = "foobar" - - [[tcp.serversTransports.TCPServersTransport1.tls.certificates]] - certFile = "foobar" - keyFile = "foobar" - [tcp.serversTransports.TCPServersTransport1.tls.spiffe] - ids = ["foobar", "foobar"] - trustDomain = "foobar" - -[udp] - [udp.routers] - [udp.routers.UDPRouter0] - entryPoints = ["foobar", "foobar"] - service = "foobar" - [udp.routers.UDPRouter1] - entryPoints = ["foobar", "foobar"] - service = "foobar" - [udp.services] - [udp.services.UDPService01] - [udp.services.UDPService01.loadBalancer] - - [[udp.services.UDPService01.loadBalancer.servers]] - address = "foobar" - - [[udp.services.UDPService01.loadBalancer.servers]] - address = "foobar" - [udp.services.UDPService02] - [udp.services.UDPService02.weighted] - - [[udp.services.UDPService02.weighted.services]] - name = "foobar" - weight = 42 - - [[udp.services.UDPService02.weighted.services]] - name = "foobar" - weight = 42 - -[tls] - - [[tls.certificates]] - certFile = "foobar" - keyFile = "foobar" - stores = ["foobar", "foobar"] - - [[tls.certificates]] - certFile = "foobar" - keyFile = "foobar" - stores = ["foobar", "foobar"] - [tls.options] - [tls.options.Options0] - minVersion = "foobar" - maxVersion = "foobar" - cipherSuites = ["foobar", "foobar"] - curvePreferences = ["foobar", "foobar"] - sniStrict = true - alpnProtocols = ["foobar", "foobar"] - disableSessionTickets = true - preferServerCipherSuites = true - [tls.options.Options0.clientAuth] - caFiles = ["foobar", "foobar"] - clientAuthType = "foobar" - [tls.options.Options1] - minVersion = "foobar" - maxVersion = "foobar" - cipherSuites = ["foobar", "foobar"] - curvePreferences = ["foobar", "foobar"] - sniStrict = true - alpnProtocols = ["foobar", "foobar"] - disableSessionTickets = true - preferServerCipherSuites = true - [tls.options.Options1.clientAuth] - caFiles = ["foobar", "foobar"] - clientAuthType = "foobar" - [tls.stores] - [tls.stores.Store0] - [tls.stores.Store0.defaultCertificate] - certFile = "foobar" - keyFile = "foobar" - [tls.stores.Store0.defaultGeneratedCert] - resolver = "foobar" - [tls.stores.Store0.defaultGeneratedCert.domain] - main = "foobar" - sans = ["foobar", "foobar"] - [tls.stores.Store1] - [tls.stores.Store1.defaultCertificate] - certFile = "foobar" - keyFile = "foobar" - [tls.stores.Store1.defaultGeneratedCert] - resolver = "foobar" - [tls.stores.Store1.defaultGeneratedCert.domain] - main = "foobar" - sans = ["foobar", "foobar"] diff --git a/docs/content/reference/routing-configuration/other-providers/file.yaml b/docs/content/reference/routing-configuration/other-providers/file.yaml deleted file mode 100644 index ae91fd329..000000000 --- a/docs/content/reference/routing-configuration/other-providers/file.yaml +++ /dev/null @@ -1,727 +0,0 @@ -## CODE GENERATED AUTOMATICALLY -## THIS FILE MUST NOT BE EDITED BY HAND -http: - routers: - Router0: - entryPoints: - - foobar - - foobar - middlewares: - - foobar - - foobar - service: foobar - rule: foobar - parentRefs: - - foobar - - foobar - ruleSyntax: foobar - priority: 42 - tls: - options: foobar - certResolver: foobar - domains: - - main: foobar - sans: - - foobar - - foobar - - main: foobar - sans: - - foobar - - foobar - observability: - accessLogs: true - metrics: true - tracing: true - traceVerbosity: foobar - Router1: - entryPoints: - - foobar - - foobar - middlewares: - - foobar - - foobar - service: foobar - rule: foobar - parentRefs: - - foobar - - foobar - ruleSyntax: foobar - priority: 42 - tls: - options: foobar - certResolver: foobar - domains: - - main: foobar - sans: - - foobar - - foobar - - main: foobar - sans: - - foobar - - foobar - observability: - accessLogs: true - metrics: true - tracing: true - traceVerbosity: foobar - services: - Service01: - failover: - service: foobar - fallback: foobar - healthCheck: {} - Service02: - highestRandomWeight: - services: - - name: foobar - weight: 42 - - name: foobar - weight: 42 - healthCheck: {} - Service03: - loadBalancer: - sticky: - cookie: - name: foobar - secure: true - httpOnly: true - sameSite: foobar - maxAge: 42 - path: foobar - domain: foobar - servers: - - url: foobar - weight: 42 - preservePath: true - - url: foobar - weight: 42 - preservePath: true - strategy: foobar - healthCheck: - scheme: foobar - mode: foobar - path: foobar - method: foobar - status: 42 - port: 42 - interval: 42s - unhealthyInterval: 42s - timeout: 42s - hostname: foobar - followRedirects: true - headers: - name0: foobar - name1: foobar - passiveHealthCheck: - failureWindow: 42s - maxFailedAttempts: 42 - passHostHeader: true - responseForwarding: - flushInterval: 42s - serversTransport: foobar - Service04: - mirroring: - service: foobar - mirrorBody: true - maxBodySize: 42 - mirrors: - - name: foobar - percent: 42 - - name: foobar - percent: 42 - healthCheck: {} - Service05: - weighted: - services: - - name: foobar - weight: 42 - - name: foobar - weight: 42 - sticky: - cookie: - name: foobar - secure: true - httpOnly: true - sameSite: foobar - maxAge: 42 - path: foobar - domain: foobar - healthCheck: {} - middlewares: - Middleware01: - addPrefix: - prefix: foobar - Middleware02: - basicAuth: - users: - - foobar - - foobar - usersFile: foobar - realm: foobar - removeHeader: true - headerField: foobar - Middleware03: - buffering: - maxRequestBodyBytes: 42 - memRequestBodyBytes: 42 - maxResponseBodyBytes: 42 - memResponseBodyBytes: 42 - retryExpression: foobar - Middleware04: - chain: - middlewares: - - foobar - - foobar - Middleware05: - circuitBreaker: - expression: foobar - checkPeriod: 42s - fallbackDuration: 42s - recoveryDuration: 42s - responseCode: 42 - Middleware06: - compress: - excludedContentTypes: - - foobar - - foobar - includedContentTypes: - - foobar - - foobar - minResponseBodyBytes: 42 - encodings: - - foobar - - foobar - defaultEncoding: foobar - Middleware07: - contentType: - autoDetect: true - Middleware08: - digestAuth: - users: - - foobar - - foobar - usersFile: foobar - removeHeader: true - realm: foobar - headerField: foobar - Middleware09: - errors: - status: - - foobar - - foobar - statusRewrites: - name0: 42 - name1: 42 - service: foobar - query: foobar - errorRequestHeaders: - - foobar - - foobar - Middleware10: - forwardAuth: - address: foobar - tls: - ca: foobar - cert: foobar - key: foobar - insecureSkipVerify: true - caOptional: true - trustForwardHeader: true - authResponseHeaders: - - foobar - - foobar - authResponseHeadersRegex: foobar - authRequestHeaders: - - foobar - - foobar - maxResponseBodySize: 42 - addAuthCookiesToResponse: - - foobar - - foobar - headerField: foobar - forwardBody: true - maxBodySize: 42 - preserveLocationHeader: true - preserveRequestMethod: true - Middleware11: - grpcWeb: - allowOrigins: - - foobar - - foobar - Middleware12: - headers: - customRequestHeaders: - name0: foobar - name1: foobar - customResponseHeaders: - name0: foobar - name1: foobar - accessControlAllowCredentials: true - accessControlAllowHeaders: - - foobar - - foobar - accessControlAllowMethods: - - foobar - - foobar - accessControlAllowOriginList: - - foobar - - foobar - accessControlAllowOriginListRegex: - - foobar - - foobar - accessControlExposeHeaders: - - foobar - - foobar - accessControlMaxAge: 42 - addVaryHeader: true - allowedHosts: - - foobar - - foobar - hostsProxyHeaders: - - foobar - - foobar - sslProxyHeaders: - name0: foobar - name1: foobar - stsSeconds: 42 - stsIncludeSubdomains: true - stsPreload: true - forceSTSHeader: true - frameDeny: true - customFrameOptionsValue: foobar - contentTypeNosniff: true - browserXssFilter: true - customBrowserXSSValue: foobar - contentSecurityPolicy: foobar - contentSecurityPolicyReportOnly: foobar - publicKey: foobar - referrerPolicy: foobar - permissionsPolicy: foobar - isDevelopment: true - featurePolicy: foobar - sslRedirect: true - sslTemporaryRedirect: true - sslHost: foobar - sslForceHost: true - Middleware13: - ipAllowList: - sourceRange: - - foobar - - foobar - ipStrategy: - depth: 42 - excludedIPs: - - foobar - - foobar - ipv6Subnet: 42 - rejectStatusCode: 42 - Middleware14: - ipWhiteList: - sourceRange: - - foobar - - foobar - ipStrategy: - depth: 42 - excludedIPs: - - foobar - - foobar - ipv6Subnet: 42 - Middleware15: - inFlightReq: - amount: 42 - sourceCriterion: - ipStrategy: - depth: 42 - excludedIPs: - - foobar - - foobar - ipv6Subnet: 42 - requestHeaderName: foobar - requestHost: true - Middleware16: - passTLSClientCert: - pem: true - info: - notAfter: true - notBefore: true - sans: true - serialNumber: true - subject: - country: true - province: true - locality: true - organization: true - organizationalUnit: true - commonName: true - serialNumber: true - domainComponent: true - issuer: - country: true - province: true - locality: true - organization: true - commonName: true - serialNumber: true - domainComponent: true - Middleware17: - plugin: - PluginConf0: - name0: foobar - name1: foobar - PluginConf1: - name0: foobar - name1: foobar - Middleware18: - rateLimit: - average: 42 - period: 42s - burst: 42 - sourceCriterion: - ipStrategy: - depth: 42 - excludedIPs: - - foobar - - foobar - ipv6Subnet: 42 - requestHeaderName: foobar - requestHost: true - redis: - endpoints: - - foobar - - foobar - tls: - ca: foobar - cert: foobar - key: foobar - insecureSkipVerify: true - username: foobar - password: foobar - db: 42 - poolSize: 42 - minIdleConns: 42 - maxActiveConns: 42 - readTimeout: 42s - writeTimeout: 42s - dialTimeout: 42s - Middleware19: - redirectRegex: - regex: foobar - replacement: foobar - permanent: true - Middleware20: - redirectScheme: - scheme: foobar - port: foobar - permanent: true - Middleware21: - replacePath: - path: foobar - Middleware22: - replacePathRegex: - regex: foobar - replacement: foobar - Middleware23: - retry: - attempts: 42 - initialInterval: 42s - Middleware24: - stripPrefix: - prefixes: - - foobar - - foobar - forceSlash: true - Middleware25: - stripPrefixRegex: - regex: - - foobar - - foobar - serversTransports: - ServersTransport0: - serverName: foobar - insecureSkipVerify: true - rootCAs: - - foobar - - foobar - certificates: - - certFile: foobar - keyFile: foobar - - certFile: foobar - keyFile: foobar - maxIdleConnsPerHost: 42 - forwardingTimeouts: - dialTimeout: 42s - responseHeaderTimeout: 42s - idleConnTimeout: 42s - readIdleTimeout: 42s - pingTimeout: 42s - disableHTTP2: true - peerCertURI: foobar - spiffe: - ids: - - foobar - - foobar - trustDomain: foobar - ServersTransport1: - serverName: foobar - insecureSkipVerify: true - rootCAs: - - foobar - - foobar - certificates: - - certFile: foobar - keyFile: foobar - - certFile: foobar - keyFile: foobar - maxIdleConnsPerHost: 42 - forwardingTimeouts: - dialTimeout: 42s - responseHeaderTimeout: 42s - idleConnTimeout: 42s - readIdleTimeout: 42s - pingTimeout: 42s - disableHTTP2: true - peerCertURI: foobar - spiffe: - ids: - - foobar - - foobar - trustDomain: foobar -tcp: - routers: - TCPRouter0: - entryPoints: - - foobar - - foobar - middlewares: - - foobar - - foobar - service: foobar - rule: foobar - ruleSyntax: foobar - priority: 42 - tls: - passthrough: true - options: foobar - certResolver: foobar - domains: - - main: foobar - sans: - - foobar - - foobar - - main: foobar - sans: - - foobar - - foobar - TCPRouter1: - entryPoints: - - foobar - - foobar - middlewares: - - foobar - - foobar - service: foobar - rule: foobar - ruleSyntax: foobar - priority: 42 - tls: - passthrough: true - options: foobar - certResolver: foobar - domains: - - main: foobar - sans: - - foobar - - foobar - - main: foobar - sans: - - foobar - - foobar - services: - TCPService01: - loadBalancer: - servers: - - address: foobar - tls: true - - address: foobar - tls: true - serversTransport: foobar - proxyProtocol: - version: 42 - terminationDelay: 42 - healthCheck: - port: 42 - send: foobar - expect: foobar - interval: 42s - unhealthyInterval: 42s - timeout: 42s - TCPService02: - weighted: - services: - - name: foobar - weight: 42 - - name: foobar - weight: 42 - healthCheck: {} - middlewares: - TCPMiddleware01: - ipAllowList: - sourceRange: - - foobar - - foobar - TCPMiddleware02: - ipWhiteList: - sourceRange: - - foobar - - foobar - TCPMiddleware03: - inFlightConn: - amount: 42 - serversTransports: - TCPServersTransport0: - dialKeepAlive: 42s - dialTimeout: 42s - proxyProtocol: - version: 42 - terminationDelay: 42s - tls: - serverName: foobar - insecureSkipVerify: true - rootCAs: - - foobar - - foobar - certificates: - - certFile: foobar - keyFile: foobar - - certFile: foobar - keyFile: foobar - peerCertURI: foobar - spiffe: - ids: - - foobar - - foobar - trustDomain: foobar - TCPServersTransport1: - dialKeepAlive: 42s - dialTimeout: 42s - proxyProtocol: - version: 42 - terminationDelay: 42s - tls: - serverName: foobar - insecureSkipVerify: true - rootCAs: - - foobar - - foobar - certificates: - - certFile: foobar - keyFile: foobar - - certFile: foobar - keyFile: foobar - peerCertURI: foobar - spiffe: - ids: - - foobar - - foobar - trustDomain: foobar -udp: - routers: - UDPRouter0: - entryPoints: - - foobar - - foobar - service: foobar - UDPRouter1: - entryPoints: - - foobar - - foobar - service: foobar - services: - UDPService01: - loadBalancer: - servers: - - address: foobar - - address: foobar - UDPService02: - weighted: - services: - - name: foobar - weight: 42 - - name: foobar - weight: 42 -tls: - certificates: - - certFile: foobar - keyFile: foobar - stores: - - foobar - - foobar - - certFile: foobar - keyFile: foobar - stores: - - foobar - - foobar - options: - Options0: - minVersion: foobar - maxVersion: foobar - cipherSuites: - - foobar - - foobar - curvePreferences: - - foobar - - foobar - clientAuth: - caFiles: - - foobar - - foobar - clientAuthType: foobar - sniStrict: true - alpnProtocols: - - foobar - - foobar - disableSessionTickets: true - preferServerCipherSuites: true - Options1: - minVersion: foobar - maxVersion: foobar - cipherSuites: - - foobar - - foobar - curvePreferences: - - foobar - - foobar - clientAuth: - caFiles: - - foobar - - foobar - clientAuthType: foobar - sniStrict: true - alpnProtocols: - - foobar - - foobar - disableSessionTickets: true - preferServerCipherSuites: true - stores: - Store0: - defaultCertificate: - certFile: foobar - keyFile: foobar - defaultGeneratedCert: - resolver: foobar - domain: - main: foobar - sans: - - foobar - - foobar - Store1: - defaultCertificate: - certFile: foobar - keyFile: foobar - defaultGeneratedCert: - resolver: foobar - domain: - main: foobar - sans: - - foobar - - foobar diff --git a/internal/gendoc.go b/internal/gendoc.go index 276b96b1a..5cd9319dc 100644 --- a/internal/gendoc.go +++ b/internal/gendoc.go @@ -1,131 +1,22 @@ package main import ( - "bytes" "fmt" "io" "os" - "reflect" - "sort" "strings" - "github.com/BurntSushi/toml" "github.com/rs/zerolog/log" "github.com/traefik/paerser/flag" "github.com/traefik/paerser/generator" "github.com/traefik/traefik/v3/cmd" - "github.com/traefik/traefik/v3/pkg/collector/hydratation" - "github.com/traefik/traefik/v3/pkg/config/dynamic" - "gopkg.in/yaml.v3" ) -var commentGenerated = `## CODE GENERATED AUTOMATICALLY -## THIS FILE MUST NOT BE EDITED BY HAND -` - func main() { - genRoutingConfDoc() genInstallConfDoc() genAnchors() } -// Generate the Routing Configuration YAML and TOML files. -func genRoutingConfDoc() { - logger := log.With().Logger() - - dynConf := &dynamic.Configuration{} - - err := hydratation.Hydrate(dynConf) - if err != nil { - logger.Fatal().Err(err).Send() - } - - dynConf.HTTP.Models = map[string]*dynamic.Model{} - clean(dynConf.HTTP.Middlewares) - clean(dynConf.TCP.Middlewares) - clean(dynConf.HTTP.Services) - clean(dynConf.TCP.Services) - clean(dynConf.UDP.Services) - - err = tomlWrite("./docs/content/reference/routing-configuration/other-providers/file.toml", dynConf) - if err != nil { - logger.Fatal().Err(err).Send() - } - err = yamlWrite("./docs/content/reference/routing-configuration/other-providers/file.yaml", dynConf) - if err != nil { - logger.Fatal().Err(err).Send() - } -} - -func yamlWrite(outputFile string, element any) error { - file, err := os.OpenFile(outputFile, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o666) - if err != nil { - return err - } - defer file.Close() - - // Write the comment at the beginning of the file. - if _, err := file.WriteString(commentGenerated); err != nil { - return err - } - - buf := new(bytes.Buffer) - encoder := yaml.NewEncoder(buf) - encoder.SetIndent(2) - err = encoder.Encode(element) - if err != nil { - return err - } - - _, err = file.Write(buf.Bytes()) - return err -} - -func tomlWrite(outputFile string, element any) error { - file, err := os.OpenFile(outputFile, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o666) - if err != nil { - return err - } - defer file.Close() - - // Write the comment at the beginning of the file. - if _, err := file.WriteString(commentGenerated); err != nil { - return err - } - - return toml.NewEncoder(file).Encode(element) -} - -func clean(element any) { - valSvcs := reflect.ValueOf(element) - - key := valSvcs.MapKeys()[0] - valueSvcRoot := valSvcs.MapIndex(key).Elem() - - var svcFieldNames []string - for i := range valueSvcRoot.NumField() { - field := valueSvcRoot.Type().Field(i) - // do not create empty node for hidden config. - if field.Tag.Get("file") == "-" && field.Tag.Get("kv") == "-" && field.Tag.Get("label") == "-" { - continue - } - - svcFieldNames = append(svcFieldNames, field.Name) - } - - sort.Strings(svcFieldNames) - - for i, fieldName := range svcFieldNames { - v := reflect.New(valueSvcRoot.Type()) - v.Elem().FieldByName(fieldName).Set(valueSvcRoot.FieldByName(fieldName)) - - valSvcs.SetMapIndex(reflect.ValueOf(fmt.Sprintf("%s%.2d", valueSvcRoot.Type().Name(), i+1)), v) - } - - valSvcs.SetMapIndex(reflect.ValueOf(fmt.Sprintf("%s0", valueSvcRoot.Type().Name())), reflect.Value{}) - valSvcs.SetMapIndex(reflect.ValueOf(fmt.Sprintf("%s1", valueSvcRoot.Type().Name())), reflect.Value{}) -} - // Generate the Install Configuration in a table. func genInstallConfDoc() { outputFile := "./docs/content/reference/install-configuration/configuration-options.md"