config.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # -*- coding: utf-8; indent-tabs-mode: nil; -*-
  2. #
  3. # This file is part of Radicale Server - Calendar Server
  4. # Copyright © 2008 The Radicale Team
  5. #
  6. # This library is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This library is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with Radicale. If not, see <http://www.gnu.org/licenses/>.
  18. from ConfigParser import RawConfigParser as ConfigParser
  19. # Default functions
  20. _config = ConfigParser()
  21. get = _config.get
  22. set = _config.set
  23. getboolean = _config.getboolean
  24. getint = _config.getint
  25. getfloat = _config.getfloat
  26. options = _config.options
  27. items = _config.items
  28. # Default config
  29. _initial = {
  30. "server": {
  31. "type": "http",
  32. "certificate": "/etc/apache2/ssl/server.crt",
  33. "privatekey": "/etc/apache2/ssl/server.key",
  34. "log": "/var/www/radicale/server.log",
  35. "port": "1001",
  36. },
  37. "encoding": {
  38. "request": "utf-8",
  39. "stock": "utf-8",
  40. },
  41. "namespace": {
  42. "C": "urn:ietf:params:xml:ns:caldav",
  43. "D": "DAV:",
  44. "CS": "http://calendarserver.org/ns/",
  45. },
  46. "status": {
  47. "200": "HTTP/1.1 200 OK",
  48. },
  49. "acl": {
  50. "type": "htpasswd",
  51. "filename": "/etc/radicale/users",
  52. },
  53. "support": {
  54. "type": "plain",
  55. "folder": "/var/local/radicale",
  56. },
  57. }
  58. # Set the default config
  59. for section, values in _initial.iteritems():
  60. _config.add_section(section)
  61. for key, value in values.iteritems():
  62. _config.set(section, key, value)
  63. # Set the user config
  64. _config.read("/etc/radicale/config")