X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=libs%2Fweb%2Fluasrc%2Fconfig.lua;h=53db82b322d58c4b4b3abb8817d579c89331c1cf;hb=e2f3b8923d2771245082a93d170699828c8d7107;hp=854b128145ca3eea715a1543cdd8898c714e9a28;hpb=d35a620e9f5665a94967f4bd02c93581a1dd7e00;p=project%2Fluci.git diff --git a/libs/web/luasrc/config.lua b/libs/web/luasrc/config.lua index 854b12814..53db82b32 100644 --- a/libs/web/luasrc/config.lua +++ b/libs/web/luasrc/config.lua @@ -25,24 +25,18 @@ limitations under the License. ]]-- -module("luci.config", package.seeall) -require("luci.model.uci") -require("luci.util") -require("luci.sys") - --- 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 = luci.model.uci.sections("luci") -if ucidata then - luci.util.update(luci.config, 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)