Directory file provider doesn't read config file

The following file provider definition doesn't read the file "server.yml" which is located in the directory

providers:
  file:
    directory: /etc/traefik/sites-enabled
    watch: true

if I use

filename: /etc/.../server.yml

It's o.k.?
Where is my fault?

Solved: providers.file.directory seams to support only toml-files :frowning:
... not documented!

The file provider support TOML and YAML files with providers.file.directory or providers.file.filename

Yes, that's what I tried. But only after I converted both the static and the dynamic files to TOML it worked.

But: Maybe I had another error so I'll give it a second tomorrow try by converting the working configuration back to YAML. ... and give feedback here.

Klaus

Yes. Should work, but for me it only works with toml files. I started with yml... didn’t work!

Klaus

A quick working example:

docker-compose.yml:

version: "3.5"

services:

  traefik:
    image: "traefik:v2.0.4"
    command:
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      - --api=true
      - --providers.docker=true
      - --providers.docker.exposedbydefault=false
      - --providers.file.directory=/config/
      - --global.sendAnonymousUsage=false
    ports:
      - "80:80"
      - "443:443"
    labels:
      - "traefik.enable=true"

      # Dashboard
      - "traefik.http.routers.traefik.rule=Host(`traefik.docker.localhost`)"
      - "traefik.http.routers.traefik.service=api@internal"
      - "traefik.http.routers.traefik.entrypoints=web"

    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - ./config/:/config/

/config/foobar.yml

http:
  routers:
    router1:
      rule: Host(`localhost`)
      service: service1
      entryPoints:
        - web

  services:
    service1:
      loadBalancer:
        servers:
          - url: http://httpbin.org

dashboard: http://traefik.docker.localhost
simple reverse: http://localhost

1 Like

Hi Fernandez:

Thanks a lot!
Meanwhile I double checked my old config and found the mistake: Wrong symbolic links!

So: How to tag this whole discussion as "wrong"?

Klaus

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.