]> git.nbdom.net Git - nb.git/commitdiff
lib/lua/nb.lua
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 16 May 2018 14:05:42 +0000 (15:05 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 16 May 2018 14:05:42 +0000 (15:05 +0100)
lib/lua/nb.lua

index cb5cae6cec83ef5a06108710df14b4b0c5c54b07..83ae42ce50a7fd90e01c65bcbbd8584d2d4e2233 100644 (file)
@@ -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