add hook for init_by_lua_block
This commit is contained in:
parent
8354478e72
commit
4d92a58349
2 changed files with 16 additions and 6 deletions
8
main.lua
8
main.lua
|
@ -12,6 +12,12 @@ require('util')
|
|||
|
||||
ctx:loadFromConfig(config.loadConfigFile())
|
||||
|
||||
return function()
|
||||
return {
|
||||
init=function ()
|
||||
-- validate config and print out errors
|
||||
config.loadConfigFile()
|
||||
end,
|
||||
access=function()
|
||||
ctx:onRequest()
|
||||
end
|
||||
}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
init_by_lua_block {
|
||||
require("aproxy.main").init()
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
lua_code_cache off;
|
||||
|
@ -7,7 +11,7 @@
|
|||
|
||||
# must happen before proxy_pass
|
||||
access_by_lua_block {
|
||||
require("aproxy.main")()
|
||||
require("aproxy.main").access()
|
||||
}
|
||||
|
||||
proxy_pass http://localhost:9999;
|
||||
|
|
Loading…
Reference in a new issue