mirror of
https://github.com/lukaszraczylo/traefikoidc.git
synced 2026-10-14 04:07:46 +00:00
fix(catalog): analyzer-valid testData and explicit New() error return
The plugin catalog analyzer failed v1.0.28 with "invalid handler type: <nil>" (#151). Two defects combined. The analyzer feeds .traefik.yml testData to New() verbatim. The header values used quadruple braces on a false premise: no configuration path collapses them. Template validation rejected them, so New() failed. The testData now carries plain, valid templates. New() also returned failures through a multi-value tail call (return NewWithContext(...)). Yaegi v0.16.1 zeroes both results of that statement on the error path. The analyzer therefore saw (nil, nil) and reported the opaque handler-type message instead of the real validation error. New() now splits the return explicitly. Construction failures surface as real error messages under yaegi and in Traefik logs. The regression tests pin both fixes. README and CONFIGURATION.md now give correct escaping guidance: plain double braces everywhere; file provider users escape with a raw string. Quadruple braces do not work anywhere. Fixes #151.
This commit is contained in:
+9
-5
@@ -60,14 +60,18 @@ testData:
|
||||
scopes:
|
||||
- roles
|
||||
|
||||
# Templated headers forwarded to backends.
|
||||
# NOTE: use quadruple braces — the YAML parser collapses {{{{ → {{ so the
|
||||
# Go template engine receives the correct expression.
|
||||
# Templated headers forwarded to backends. Values are Go templates and must
|
||||
# be written with plain double braces — the catalog analyzer feeds them to
|
||||
# the plugin verbatim (issue #151; quadruple braces do NOT get collapsed).
|
||||
# Only when your dynamic config file is rendered by Traefik's file-provider
|
||||
# Go templating do the braces need escaping there, e.g.
|
||||
# value: "{{`{{.Claims.email}}`}}"
|
||||
# (see README "Templated headers").
|
||||
headers:
|
||||
- name: X-User-Email
|
||||
value: "{{{{.Claims.email}}}}"
|
||||
value: "{{.Claims.email}}"
|
||||
- name: Authorization
|
||||
value: "Bearer {{{{.AccessToken}}}}"
|
||||
value: "Bearer {{.AccessToken}}"
|
||||
|
||||
# Security headers (default profile is enabled out of the box)
|
||||
securityHeaders:
|
||||
|
||||
Reference in New Issue
Block a user