Skip to content
Snippets Groups Projects
Unverified Commit 13b32535 authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

gluon-core: make old site_config library reference new one, not the other way around

parent ee6aface
No related branches found
No related tags found
No related merge requests found
local site = require 'gluon.site_config'
local site = (function()
local config = '/lib/gluon/site.json'
local json = require 'luci.jsonc'
local decoder = json.new()
local sink = decoder:sink()
local file = assert(io.open(config))
while true do
local chunk = file:read(2048)
if not chunk or chunk:len() == 0 then break end
sink(chunk)
end
file:close()
return assert(decoder:get())
end)()
local wrap
......
local function get_site_config()
local config = '/lib/gluon/site.json'
local json = require 'luci.jsonc'
local decoder = json.new()
local sink = decoder:sink()
local file = assert(io.open(config))
while true do
local chunk = file:read(2048)
if not chunk or chunk:len() == 0 then break end
sink(chunk)
end
file:close()
return assert(decoder:get())
end
local site = require 'gluon.site'
local setmetatable = setmetatable
module 'gluon.site_config'
setmetatable(_M, {
__index = get_site_config(),
__index = site(),
})
return _M
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment