From 5bc9fbd1192fd2c8aa31ec6a8aa5d90270c826e6 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Wed, 16 May 2018 15:05:42 +0100 Subject: [PATCH] lib/lua/nb.lua --- lib/lua/nb.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/lua/nb.lua b/lib/lua/nb.lua index cb5cae6c..83ae42ce 100644 --- a/lib/lua/nb.lua +++ b/lib/lua/nb.lua @@ -17,6 +17,11 @@ function nb:readall(file) end end +function nb:ngx_tmpl_file(file,fheader,ffooter) + ngx.ctx.tmpl_content = self:readall(file) + self:ngx_location_tmpl(fheader,ffooter) +end + function nb:ngx_tmpl(content,fheader,ffooter) ngx.ctx.tmpl_content = content self:ngx_location_tmpl(fheader,ffooter) @@ -134,4 +139,9 @@ function nb:ngx_cmd(cmd) return 0 end +function nb:script_path() + local str = debug.getinfo(2, "S").source:sub(2) + return str:match("(.*)/") +end + return nb -- 2.47.3