Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

traefik.toml constraints error: Expected map but found 'string'. #451

Closed
calvinmorrow opened this issue Jun 10, 2016 · 3 comments
Closed

Comments

@calvinmorrow
Copy link

Using the containous/traefik:v1.0.0-rc2 docker image against a consulCatalog backend:

traefik.toml snippet:

[consulCatalog]
constraints = ["tag==foo"]

Errors with:
2016/06/10 15:20:16 Error reading TOML config file /etc/traefik/traefik.toml : Type mismatch for 'main.TraefikConfiguration.ConsulCatalog': Type mismatch for 'provider.ConsulCatalog.Constraints': Type mismatch for types.Constraint. Expected map but found 'string'.

Using the following command line option works:
--consulCatalog.constraints=tag==foo

@vdemeester vdemeester added the bug label Jun 10, 2016
@vdemeester vdemeester added this to the 1.0 milestone Jun 10, 2016
@samber samber self-assigned this Jun 11, 2016
@emilevauge
Copy link
Member

Hi @calvinmorrow
It seems there is an issue with toml documentation on constraints sorry.

[[consulCatalog.constraints]]
  key = "tag==foo"

should work.
/cc @samber

@tiagostutz
Copy link

tiagostutz commented Jul 6, 2016

Well, I trying to achieve this with docker, but didn't work. Using global constraint works, but the configuration had to be slightly different:

[[constraints]]  
  key = "tag"  
  mustmatch = true  
  regex = "app"  

If I put just key = "tag==foo" then the Constraints object on Global configuration will be:
"Constraints":[{"Key":"tag==foo","MustMatch":false,"Regex":""}]; it isn't splitting the string and putting each part on its respective attribute.

Putting as I suggest above will fix it, turning the Constraints correctly into "Constraints":[{"Key":"tag","MustMatch":true,"Regex":"foo"}]

Also, I'm confused with the correct syntax. In #481 it suggests the following syntax, which doesn't work:

[docker]
  endpoint = "unix:///var/run/docker.sock"
  constraints = ["tag==api", "tag==he*ld"]

Is the syntax for this configuration already defined as a consensus?

@emilevauge
Copy link
Member

Hi @tiagostutz, there is also an issue on toml parsing with constraints. Constraints will fully supported in 1.1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants