mirror of
https://github.com/YunoHost/SSOwat.git
synced 2024-09-03 20:06:27 +02:00
[enh] Add persistent rules (as conf.json.persistent)
This commit is contained in:
parent
5c6c8fdf39
commit
8d53f1b366
1 changed files with 24 additions and 2 deletions
22
access.lua
22
access.lua
|
@ -10,8 +10,30 @@ if not srvkey then
|
||||||
end
|
end
|
||||||
oneweek = 60 * 60 * 24 * 7
|
oneweek = 60 * 60 * 24 * 7
|
||||||
cookies = {}
|
cookies = {}
|
||||||
|
|
||||||
|
-- Load conf file
|
||||||
local conf_file = assert(io.open(conf_path, "r"), "Configuration file is missing")
|
local conf_file = assert(io.open(conf_path, "r"), "Configuration file is missing")
|
||||||
local conf = json.decode(conf_file:read("*all"))
|
local conf = json.decode(conf_file:read("*all"))
|
||||||
|
|
||||||
|
-- Load additional rules
|
||||||
|
local persistent_conf_file = io.open(conf_path..".persistent", "r")
|
||||||
|
if persistent_conf_file ~= nil then
|
||||||
|
for k, v in pairs(json.decode(persistent_conf_file:read("*all"))) do
|
||||||
|
-- If key already exists and is an table, merge it
|
||||||
|
if conf[k] and type(v) == "table" then
|
||||||
|
for subk, subv in pairs(v) do
|
||||||
|
if type(subk) == "number" then
|
||||||
|
table.insert(conf[k], subv)
|
||||||
|
else
|
||||||
|
conf[k][subk] = subv
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
conf[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local portal_url = conf["portal_scheme"].."://"..
|
local portal_url = conf["portal_scheme"].."://"..
|
||||||
conf["portal_domain"]..
|
conf["portal_domain"]..
|
||||||
conf["portal_path"]
|
conf["portal_path"]
|
||||||
|
|
Loading…
Reference in a new issue