Safe3-openresty-manager/nginx/lua/ngx_conf_init.lua
UUSEC Technology 12467d8fd1 open source
2025-04-30 13:05:17 +08:00

16 lines
342 B
Lua

local cjson = require("cjson.safe")
collectgarbage("collect")
local f = io.open("/opt/om/nginx/lua/cfg.json", "r")
local content = f:read("*a")
f:close()
local cfg = cjson.decode(content)
-- init modules
local ok, res
ok, res = pcall(require, "om")
if not ok then
error("require failed: " .. tostring(res))
else
res.set_config(cfg)
end