X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=libs%2Fweb%2Fluasrc%2Fconfig.lua;h=53db82b322d58c4b4b3abb8817d579c89331c1cf;hb=b360dbc6dcd283d7ce70217701f57a4e2601ee99;hp=dd3e01734ea20bac7b23890f4bcb0d083dc4310e;hpb=45319b232bc331492dd98e474c9ea60a9a70bc8f;p=oweals%2Fluci.git diff --git a/libs/web/luasrc/config.lua b/libs/web/luasrc/config.lua index dd3e01734..53db82b32 100644 --- a/libs/web/luasrc/config.lua +++ b/libs/web/luasrc/config.lua @@ -26,13 +26,17 @@ limitations under the License. ]]-- local util = require "luci.util" - -local pcall = pcall -local require = require - - -module "luci.config" - -pcall(function() - setmetatable(_M, {__index=require "luci.model.uci".cursor():get_all("luci")}) -end) +module("luci.config", + function(m) + if pcall(require, "luci.model.uci") then + local config = util.threadlocal() + setmetatable(m, { + __index = function(tbl, key) + if not config[key] then + config[key] = luci.model.uci.cursor():get_all("luci", key) + end + return config[key] + end + }) + end + end)