Kong / kong-python-pdk

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

How to use start_server #113

Closed luozhouyang closed 1 year ago

luozhouyang commented 1 year ago

I found that all examples use a start_dedicated_server function to start the plugin server. But there is also a start_server function. If I am not wrong, this start_server can serve multi plugins with one PluginServer instance, but how should I use this function? Should I put these code in every python plugin file?

if __name__ == "__main__":
    from kong_pdk.cli import start_server
    start_server(...)

If so, multi PluginServer instances will be created, is it right?

fffonion commented 1 year ago

Hi @luozhouyang , start_server starts a shared server that can be used to manage multiple plugins. In this use case, simply use the kong-python-pluginserver command and point -d to the directory containing all your plugin files.

luozhouyang commented 1 year ago

@fffonion Thanks!

luozhouyang commented 1 year ago

I found a example, just for someone need it: