diff options
Diffstat (limited to 'www/cgi-bin/mvc.lua')
-rwxr-xr-x | www/cgi-bin/mvc.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/www/cgi-bin/mvc.lua b/www/cgi-bin/mvc.lua index aef3547..4ded73d 100755 --- a/www/cgi-bin/mvc.lua +++ b/www/cgi-bin/mvc.lua @@ -260,6 +260,20 @@ read_config = function( self, appname ) break end end + + if (#self.conf.confdir) then -- check for an appname-hooks.lua file + self.conf.app_hooks = {} + setmetatable (self.conf.app_hooks, {__index = _G}) + + -- loadfile loads into the global environment + -- so we set env 0, not env 1 + setfenv (0, self.conf.app_hooks) + local f = loadfile(self.conf.confdir .. "/" .. appname.. "-hooks.lua") + if (f) then f() end + setfenv (0, _G) + -- setmetatable (self.conf.app_hooks, {}) + end + end -- parse a "URI" like string into a prefix, controller and action |