Kong / kong-python-pdk

Write Kong plugins in Python (Experimental)
Apache License 2.0
40 stars 14 forks source link

Priority of plugin is always 0 (zero). #66

Closed krahb closed 2 years ago

krahb commented 2 years ago

I developed a Python plugin using the dedicated server from the PDK and set the priority like this:

# stuff deleted
priority = 1100
# stuff deleted
    start_dedicated_server(
        "myplugin",
        Plugin,
        version,
        priority,
        Schema)

Unfortunately when I start kong and issue the --dump option to my plugin it replies with a priority of 0:

[{"Name": "myplugin", "Phases": ["access"], "Priority": 0, "Schema": "..."}]

After some digging I found that in the module.py the priority is set to 0 and never updated. This is caused by line 59 where the attr is changed to uppercase which is then never found (because it is lowercase). I found that if I remove the .upper() the priority is correctly set, but I don't think that is a pythonic way of doing it.