init_by_lua_block {
require ("webcore"){name = "core", prefix = "bjne"}
}
http {
location / {
access_by_lua_block {
webcore()
}
content_by_lua_block {
webcore()
}
}
}
https://github.com/bjne/lua-resty-require
place a list of the plugins you want to hook in in:
package.path/{{ prefix }}/plugins/{{ name }}.lua
bjne/plugins/core.lua
return {
"bjne.foo",
"bjne.bar"
}
bjne/bar.lua
return {
access = {
action = function() return true end
},
content = {
action = function() return true, nil, ngx.say("bar") end,
after = "bjne.foo"
}
}
bjne/foo.lua
return {
content = {
action = function() return true, nil, ngx.say("foo") end
}
}
[comment]: <> # vim: ts=4 et