luci-app-radicale2: Add v2 of CalDAV/CardDAV server
[project/luci.git] / applications / luci-app-radicale2 / luasrc / model / cbi / radicale2 / logging.lua
1 -- Licensed to the public under the Apache License 2.0.
2
3 local m = Map("radicale2", translate("Radicale 2.x"),
4 translate("A lightweight CalDAV/CardDAV server"))
5
6 local s = m:section(NamedSection, "logging", "section", translate("Logging"))
7 s.addremove = true
8 s.anonymous = false
9
10 local logging_file = nil
11
12 logging_file = s:option(FileUpload, "config", translate("Logging File"), translate("Log configuration file (no file means default procd which ends up in syslog"))
13 logging_file.rmempty = true
14 logging_file.default = ""
15
16 o = s:option(Button, "remove_conf", translate("Remove configuration for logging"),
17 translate("This permanently deletes configuration for logging"))
18 o.inputstyle = "remove"
19
20 function o.write(self, section)
21 if logging_file:cfgvalue(section) and fs.access(logging_file:cfgvalue(section)) then fs.unlink(loggin_file:cfgvalue(section)) end
22 self.map:del(section, "config")
23 luci.http.redirect(luci.dispatcher.build_url("admin", "services", "radicale2", "logging"))
24 end
25
26 o = s:option(Flag, "debug", translate("Debug"), translate("Send debug information to logs"))
27 o.rmempty = true
28 o.default = o.disabled
29
30 o = s:option(Flag, "full_environment", translate("Dump Environment"), translate("Include full environment in logs"))
31 o.rmempty = true
32 o.default = o.disabled
33
34 o = s:option(Flag, "mask_passwords", translate("Mask Passwords"), translate("Redact passwords in logs"))
35 o.rmempty = true
36 o.default = o.enabled
37
38 -- TODO: Allow configuration logging file from this page
39
40 return m