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