Commit bee67e07 authored by Mika Havela's avatar Mika Havela
Browse files

List current configuration on status-page

git-svn-id: svn://svn.alpinelinux.org/acf/dnscache/trunk@1112 ab2d0c66-481e-0410-8bed-d214d4d58bed
parent 73bc3b39
......@@ -45,6 +45,19 @@ local function humanreadable(value)
return myvalue
end
local function list_servers()
local serverlist = {}
local serverdetails = {}
for k,v in pairs(posix.dir(baseurl .. "servers")) do
if not string.match(v, "^%.") then
if (fs.is_file(baseurl .. "servers/" .. v)) then
table.insert(serverlist, v)
serverdetails[v] = fs.read_file_as_array(baseurl .. "servers/" .. v)
end
end
end
return serverlist, serverdetails
end
-- ################################################################################
-- PUBLIC FUNCTIONS
......@@ -88,6 +101,13 @@ function getstatus()
value=humanreadable(config.CACHESIZE or ""),
})
local serverlist, serverdetails = list_servers()
status.servers = cfe({ name="servers",
label="Configured DNS-servers",
value=serverlist,
option=serverdetails,
})
return status
end
......
......@@ -25,5 +25,25 @@ local myform = form.status
local tags = { "ip", "cachesize", }
displayinfo(myform,tags,"viewonly")
?>
<?
local myform = form.status.servers
io.write("\t<DT")
if (myform.errtxt) then io.write(" class='error'") end
io.write(">" .. myform.label .. "</DT>\n")
io.write("\t\t<DD>\n")
for k,v in pairs(myform.value or {}) do
io.write("\t\t\t<TABLE STYLE='margin-bottom:10px;'>")
io.write("\n\t\t\t<TR><TD STYLE='font-weight:bold;'><IMG SRC='/static/tango/16x16/status/network-idle.png' width='16' height='16' alt> " .. v .. "</TD><TD></TD></TR>\n")
for k1,v1 in pairs(myform.option[v]) do
io.write("\n\t\t\t<TR STYLE='padding-bottom:10px;'><TD WIDTH='150px' STYLE='padding-left:30px;'>"..v1)
end
io.write("\t\t\t</TABLE>")
end
io.write("\t\t</DD>\n")
?>
</DL>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment