luci/modules/luci-base/luasrc/config.lua

19 lines
477 B
Lua
Raw Normal View History

-- Copyright 2008 Steven Barth <steven@midlink.org>
-- Licensed to the public under the Apache License 2.0.
2008-12-05 15:36:44 +00:00
local util = require "luci.util"
2008-09-05 18:39:42 +00:00
module("luci.config",
function(m)
if pcall(require, "luci.model.uci") then
2008-12-05 15:36:44 +00:00
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
})
2008-09-05 18:39:42 +00:00
end
2008-12-05 15:36:44 +00:00
end)