35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
from radicale import Application, config
|
|
from wsgiref.simple_server import make_server
|
|
import os
|
|
|
|
def run_server():
|
|
# Load default configuration
|
|
configuration = config.load()
|
|
|
|
# Customize settings
|
|
configuration.update({
|
|
"server": {
|
|
"hosts": "0.0.0.0:5232", # Listen on all interfaces
|
|
},
|
|
|
|
"storage": {
|
|
"filesystem_folder": "./calendars", # Store calendars here
|
|
},
|
|
"auth": {
|
|
"type": "htpasswd",
|
|
"htpasswd_filename": "./htpasswd", # Path to htpasswd file
|
|
"htpasswd_encryption": "autodetect", # or "sha1", "md5" (bcrypt is most secure)
|
|
},
|
|
|
|
})
|
|
|
|
# Create and run the app
|
|
app = Application(configuration=configuration)
|
|
server = make_server("0.0.0.0", 5232, app)
|
|
print("✅ Secure CalDAV server running on http://0.0.0.0:5232")
|
|
print("🔐 Authentication required. Default user: admin / password")
|
|
server.serve_forever()
|
|
|
|
if __name__ == "__main__":
|
|
run_server()
|