NGINX: Remove inline Lua from template. (#11806)
This commit is contained in:
parent
ee61440780
commit
6510535ae0
30 changed files with 361 additions and 233 deletions
30
rootfs/etc/nginx/lua/ngx_conf_init_stream.lua
Normal file
30
rootfs/etc/nginx/lua/ngx_conf_init_stream.lua
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
local cjson = require("cjson.safe")
|
||||
collectgarbage("collect")
|
||||
local f = io.open("/etc/nginx/lua/cfg.json", "r")
|
||||
local content = f:read("*a")
|
||||
f:close()
|
||||
local configfile = cjson.decode(content)
|
||||
-- init modules
|
||||
local ok, res
|
||||
ok, res = pcall(require, "configuration")
|
||||
if not ok then
|
||||
error("require failed: " .. tostring(res))
|
||||
else
|
||||
configuration = res
|
||||
end
|
||||
ok, res = pcall(require, "tcp_udp_configuration")
|
||||
if not ok then
|
||||
error("require failed: " .. tostring(res))
|
||||
else
|
||||
tcp_udp_configuration = res
|
||||
if not configfile.listen_ports.status_port then
|
||||
error("required status port not found")
|
||||
end
|
||||
tcp_udp_configuration.prohibited_localhost_port = configfile.listen_ports.status_port
|
||||
end
|
||||
ok, res = pcall(require, "tcp_udp_balancer")
|
||||
if not ok then
|
||||
error("require failed: " .. tostring(res))
|
||||
else
|
||||
tcp_udp_balancer = res
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue