]]--
-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)