diff options
Diffstat (limited to 'modules/luci-lua-runtime/luasrc/config.lua')
-rw-r--r-- | modules/luci-lua-runtime/luasrc/config.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/luci-lua-runtime/luasrc/config.lua b/modules/luci-lua-runtime/luasrc/config.lua new file mode 100644 index 0000000000..d01153f4f5 --- /dev/null +++ b/modules/luci-lua-runtime/luasrc/config.lua @@ -0,0 +1,18 @@ +-- Copyright 2008 Steven Barth <steven@midlink.org> +-- Licensed to the public under the Apache License 2.0. + +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) |