最后在openresty的lua_package_path配置里,加上双分号解决该问题
https://blog.csdn.net/li396864285/article/details/78493710
http://www.thijsschreijer.nl/blog/?p=1025
A more conservative way of installing your plugin’s sources is
to avoid “polluting” the LuaRocks tree, and instead, point Kong
to the directory containing them.
This is done by tweaking the lua_package_path
property of your Kong
configuration. Under the hood, this property is an alias to the LUA_PATH
variable of the Lua VM, if you are familiar with it.
Those properties contain a semicolon-separated list of directories in
which to search for Lua sources. It should be set like so in your Kong
configuration file:
1 2 |
lua_package_path = /<path-to-plugin-location>/?.lua;; |
- 1
- 2
Where:
/<path-to-plugin-location>
is the path to the directory containing the
extracted archive. It should be the location of thekong
directory
from the archive.?
is a placeholder that will be replaced by
kong.plugins.<plugin-name>
when Kong will try to load your plugin. Do
not change it.;;
a placeholder for the “the default Lua path”. Do not change it.
Example:
The plugin something
being located on the file system such that the
handler file is:
1 2 |
/usr/local/custom/kong/plugins/<something>/handler.lua |
- 1
- 2
The location of the kong
directory is: /usr/local/custom, hence the
proper path setup would be:
1 2 |
lua_package_path = /usr/local/custom/?.lua;; |
- 1
- 2
Multiple plugins:
If you wish to install two or more custom plugins this way, you can set
the variable to something like:
1 2 |
lua_package_path = /path/to/plugin1/?.lua;/path/to/plugin2/?.lua;; |
- 1
- 2
;
is the separator between directories.;;
still means “the default Lua path”.
Note: you can also set this property via its environment variable
equivalent: KONG_LUA_PACKAGE_PATH
.