config.lua 477 B

123456789101112131415161718
  1. -- Copyright 2008 Steven Barth <steven@midlink.org>
  2. -- Licensed to the public under the Apache License 2.0.
  3. local util = require "luci.util"
  4. module("luci.config",
  5. function(m)
  6. if pcall(require, "luci.model.uci") then
  7. local config = util.threadlocal()
  8. setmetatable(m, {
  9. __index = function(tbl, key)
  10. if not config[key] then
  11. config[key] = luci.model.uci.cursor():get_all("luci", key)
  12. end
  13. return config[key]
  14. end
  15. })
  16. end
  17. end)