Single quote or back tics?

hi, are these single quotes or back tics? rule = "Host(traefik.io) || (Host(containo.us) && Path(/traefik))"

Hello,

it's backticks.

"Host(`traefik.io`) || (Host(`containo.us`) && Path(`/traefik`))"

Thank you for responding!

Hi Idez,

Can you tell us the difference between the the single quote and back ticks? When should we use back tick vs. single quotes?

I cannot find any references to it in the documentation, and it seems like single quotes breaks configuration. Given that backticks looks like single quotes, i think documentation needs to point out what character it is, how are each characters being treated by new version of Traefik.

Thanks,
Connie

Single quotes are never used in the rule definition, only back-ticks.

https://golang.org/ref/spec#String_literals

Is there a way we can put this in the documentation? (I don't mind contributing) While yes, many know that Traefik is written in golang, but whether rules should be defined with golang syntax specifics in mind, i'm not sure everyone will understand without explicitly specifying this in the documentation.

Also - this is a new introduction when coming from version 1.7. v1.7 docs/examples do not have any back-ticks at all, and v1.7 was written in golang as well. So for folks doing the migration this would be a good note to have.

Take a look to https://github.com/containous/traefik/pull/5714

Thanks for the help provided on this thread!

Backticks can be problematic when doing bash based DevOps scripts for kubectl / kustomize and trying to deploy IngressRoute CRD's. So just in case this helps someone, I wanted to point out that escaping the backtick in bash is actually quite easy, and lets you stick with a simple way of defining the Go value in your script:

# (using \` to escape them)
cat >${OVERLAY_DIR}/ingress-host.yaml <<EOF

- op: replace
  path: /spec/routes/0/match
  value: Host(\`${RELEASE_ENV_NAME}.backend.example.com\`)

- op: replace
  path: /spec/tls/domains/0/sans/0
  value: ${RELEASE_ENV_NAME}.backend.example.com

EOF

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