Willy,
Thierry,
Vincent,
I've just prepared a new version of my proposal with the following differences:
1. I adjusted the documentation as suggested by Willy.
2. I added support for `package.cpath` as suggested by Thierry.
3. I added a build time option to be used by distros as suggested by Vincent.
The build time option will appear in the OPTIONS value of `haproxy -vv` and
default
to empty:
OPTIONS = USE_LUA=1 HLUA_PREPEND_PATH=/foobar/baz/?
With that build option and this configuration:
lua-prepend-path /etc/haproxy/lua-modules/?/init.lua
lua-prepend-path /etc/haproxy/lua-modules/?.lua
lua-prepend-path /etc/haproxy/lua-cmodules/?.lua cpath
The loaded paths look like this:
[timwolla@/s/haproxy (lua-prepend-path) [1]]./haproxy -d -f
./haproxy.cfg
13:52:53
[ALERT] 011/135320 (27431) : parsing [./haproxy.cfg:6] : Lua runtime
error: /tmp/haproxy-auth-request/auth-request.lua:23: module 'http' not found:
no field package.preload['http']
no file '/etc/haproxy/lua-modules/http.lua'
no file '/etc/haproxy/lua-modules/http/init.lua'
no file '/foobar/baz/http'
no file '/usr/local/share/lua/5.3/http.lua'
no file '/usr/local/share/lua/5.3/http/init.lua'
no file '/usr/local/lib/lua/5.3/http.lua'
no file '/usr/local/lib/lua/5.3/http/init.lua'
no file '/usr/share/lua/5.3/http.lua'
no file '/usr/share/lua/5.3/http/init.lua'
no file './http.lua'
no file './http/init.lua'
no file '/etc/haproxy/lua-cmodules/http.lua'
no file '/usr/local/lib/lua/5.3/http.so'
no file '/usr/lib/x86_64-linux-gnu/lua/5.3/http.so'
no file '/usr/lib/lua/5.3/http.so'
no file '/usr/local/lib/lua/5.3/loadall.so'
no file './http.so'
Please have a look if you are happy with my adjustments.
Best regards
Tim Duesterhus (3):
MINOR: lua: Add hlua_prepend_path function
MINOR: lua: Add lua-prepend-path configuration option
MINOR: lua: Add HLUA_PREPEND_C?PATH build option
Makefile | 10 ++++++++
doc/configuration.txt | 26 +++++++++++++++++++++
src/hlua.c | 54 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 90 insertions(+)
--
2.24.1