luci-app-radicale2: Add v2 of CalDAV/CardDAV server
[project/luci.git] / applications / luci-app-radicale2 / luasrc / model / cbi / radicale2 / storage.lua
1 -- Licensed to the public under the Apache License 2.0.
2
3 local rad2 = luci.controller.radicale2
4 local fs = require("nixio.fs")
5
6 local m = Map("radicale2", translate("Radicale 2.x"),
7 translate("A lightweight CalDAV/CardDAV server"))
8
9 local s = m:section(NamedSection, "storage", "section", translate("Storage"))
10 s.addremove = true
11 s.anonymous = false
12
13 o = s:option(ListValue, "type", translate("Storage Type"))
14 o:value("", translate("Default (multifilesystem)"))
15 o:value("multifilesystem", translate("Multiple files on filesystem"))
16 o.default = ""
17 o.rmempty = true
18
19 o = s:option(Value, "filesystem_folder", translate("Folder"), translate("Folder in which to store collections"))
20 o:depends("type", "")
21 o:depends("type", "multifilesystem")
22 o.rmempty = true
23 o.placeholder = "/srv/radicale2/data"
24
25 o = s:option(Flag, "filesystem_locking", translate("Use File Locks"), translate("Prevent other instances or processes from modifying collections while in use"))
26 o:depends("type", "")
27 o:depends("type", "multifilesystem")
28 o.rmempty = true
29 o.default = o.enabled
30
31 o = s:option(Value, "max_sync_token_age", translate("Max Sync Token Age"), translate("Delete sync token that are older (seconds)"))
32 o:depends("type", "")
33 o:depends("type", "multifilesystem")
34 o.rmempty = true
35 o.placeholder = 2592000
36 o.datatype = "uinteger"
37
38 o = s:option(Flag, "filesystem_close_lock_file", translate("Close Lock File"), translate("Close the lock file when no more clients are waiting"))
39 o:depends("type", "")
40 o:depends("type", "multifilesystem")
41 o.rmempty = true
42 o.default = o.disabled
43
44 o = s:option(Value, "hook", translate("Hook"), translate("Command that is run after changes to storage"))
45 o:depends("type", "")
46 o:depends("type", "multifilesystem")
47 o.rmempty = true
48 o.placeholder = ("Example: ([ -d .git ] || git init) && git add -A && (git diff --cached --quiet || git commit -m \"Changes by \"%(user)s")
49
50 return m