1870462663a82ba5dbca51f35c234b3a4e0c3d81
[project/luci.git] / applications / luci-app-unbound / luasrc / model / cbi / unbound / server.lua
1 -- Copyright 2016 Eric Luehrsen <ericluehrsen@hotmail.com>
2 -- Licensed to the public under the Apache License 2.0.
3
4 local filename = "/etc/unbound/unbound_srv.conf"
5 local m3, s3, frm
6
7 m3 = SimpleForm("editing", nil)
8 m3.submit = translate("Save")
9 m3.reset = false
10
11 s3 = m3:section(SimpleSection, "Unbound Server Conf",
12   translatef("This allows you to edit %s which is copied to"
13   .. " /var/ and 'include:' within the 'server:' section.", filename))
14
15 frm = s3:option(TextValue, "data")
16 frm.datatype = "string"
17 frm.rows = 20
18
19
20 function frm.cfgvalue()
21   return nixio.fs.readfile(filename) or ""
22 end
23
24
25 function frm.write(self, section, data)
26   return nixio.fs.writefile(filename, data)
27 end
28
29
30 return m3
31