Traefik custom plugin and array values

Hello!
Lets imagine I have custom plugin.
And next labels in docker-compose file.

"traefik.http.routers.my-router.middlewares=my-plugin"
"traefik.http.middlewares.my-plugin.plugin.superPlugin.enabled=true"
"traefik.http.middlewares.my-plugin.plugin.superPlugin.key1=value1"
"traefik.http.middlewares.my-plugin.plugin.superPlugin.key2=value2"
"traefik.http.middlewares.my-plugin.plugin.superPlugin.key3=?"

The main question is: what is the best practice to set array values or dictionary values to key3?
Something like json

{
  "key3": {
    "k1": "v1",
    "k2": "v2" 
  }
}

I think yaml itself has an array format:

"traefik.http.middlewares.my-plugin.plugin.superPlugin.key[1]=value1"
"traefik.http.middlewares.my-plugin.plugin.superPlugin.key[2]=value2"
"traefik.http.middlewares.my-plugin.plugin.superPlugin.key[3]['k1']=v1"
"traefik.http.middlewares.my-plugin.plugin.superPlugin.key[3]['k2']=v2"

In Traefik config arrays are sometimes separated by , (when assigning middlewares or entrypoints), you could use your own annotation like =k1:v1,k2:v2.

Thanx! Got it.

Something like

  - "traefik.http.middlewares.my-plugin.plugin.superPlugin.values[0].key=k1"
  - "traefik.http.middlewares.my-plugin.plugin.superPlugin.values[0].value=v1"
  - "traefik.http.middlewares.my-plugin.plugin.superPlugin.values[1].key=k2"
  - "traefik.http.middlewares.my-plugin.plugin.superPlugin.values[1].value=v2"

But very important: config's struct field must be named Values

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