X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Fweb%2Fluasrc%2Fconfig.lua;h=53db82b322d58c4b4b3abb8817d579c89331c1cf;hp=4eb8e46e4fcb614b7a9520d9d0eccd751cfb77ad;hb=7540f86d40b23b04dd2de16ed90fc024d2cfa4ce;hpb=b454395a8da4013aff2ecd64cd7eafc01fc6a5a2 diff --git a/libs/web/luasrc/config.lua b/libs/web/luasrc/config.lua index 4eb8e46e4..53db82b32 100644 --- a/libs/web/luasrc/config.lua +++ b/libs/web/luasrc/config.lua @@ -25,23 +25,18 @@ limitations under the License. ]]-- -local uci = require("luci.model.uci") -local util = require("luci.util") -module("luci.config") - --- Warning! This is only for fallback and compatibility purporses! -- -main = {} - --- This is where stylesheets and images go -main.mediaurlbase = "/luci/media" - --- Does anybody think about browser autodetect here? --- Too bad busybox doesn't populate HTTP_ACCEPT_LANGUAGE -main.lang = "de" - - --- Now overwrite with UCI values -local ucidata = uci.sections("luci") -if ucidata then - util.update(_M, ucidata) -end \ No newline at end of file +local util = require "luci.util" +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)