diff --git a/src/main.py b/src/main.py index 8a202dd91d2efba61b1884d7d6e2bbc4a0ce7d82..d73f1459b8d0d1da8050789b894232bf36fbc5d8 100644 --- a/src/main.py +++ b/src/main.py @@ -1,8 +1,19 @@ +"""Configure and start the WSGI DAV Server.""" import logging import os +import sentry_sdk from cheroot import wsgi from wsgidav.wsgidav_app import WsgiDAVApp +from repdav.config import AppConfig + +app_config = AppConfig() + +if app_config.dsn: + sentry_sdk.init( + app_config.dsn, + traces_sample_rate=1.0 + ) logging.basicConfig(level=logging.DEBUG, format='%(name)s %(levelname)s %(asctime)s %(message)s') @@ -19,20 +30,14 @@ TMP_logger.setLevel(logging.WARNING) # Configuration of the WsgiDAVApp. # https://wsgidav.readthedocs.io/en/latest/user_guide_configure.html +# TODO: move to config.py config = { - "host": os.getenv("host"), - "port": int(os.getenv("port")), + "host": os.getenv("host") or "localhost", + "port": int(os.getenv("port") or "8080"), "provider_mapping": { "/": {"provider": "repdav.textgrid_dav_provider.TextgridResourceProvider"}, }, "verbose": 1, - "simple_dc": { - "user_mapping": { - "*": { - "user": { - "password": "pass"}} - } - }, "http_authenticator": { "domain_controller": "repdav.textgrid_domain_controller.TextgridDC", "accept_basic": True, # Allow basic authentication, True or False