storage.lua 1.9 KB

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