Skip to content
Snippets Groups Projects
Verified Commit 5718696c authored by Stefan Hynek's avatar Stefan Hynek :drooling_face:
Browse files

refactor(main): configure certain wsgidav settings from AppConfig

this includes, host, port, and the newly introduced tg_host key
parent fab21bcf
No related branches found
No related tags found
1 merge request!24Resolve "make host, port, dsn and textgrid host configurable"
Pipeline #342887 passed
......@@ -4,8 +4,6 @@
"""Configure and start the WSGI DAV Server."""
import logging
import os
import sentry_sdk
from cheroot import wsgi
from wsgidav.wsgidav_app import WsgiDAVApp
......@@ -14,13 +12,11 @@ from repdav.config import AppConfig
app_config = AppConfig()
if app_config.dsn:
sentry_sdk.init(
app_config.dsn,
traces_sample_rate=1.0
)
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')
logging.basicConfig(
level=logging.DEBUG, format="%(name)s %(levelname)s %(asctime)s %(message)s"
)
_logger = logging.getLogger(__name__)
_logger.propagate = True
......@@ -31,12 +27,13 @@ tmp_logger.setLevel(logging.DEBUG)
# Configuration of the WsgiDAVApp.
# https://wsgidav.readthedocs.io/en/latest/user_guide_configure.html
# TODO: move to config.py
config = {
"host": os.getenv("host") or "localhost",
"port": int(os.getenv("port") or "8080"),
"host": app_config.host,
"port": app_config.port,
"provider_mapping": {
"/": {"class": "repdav.textgrid_named_dav_provider.TextgridNamedResourceProvider"},
"/": {
"class": "repdav.textgrid_named_dav_provider.TextgridNamedResourceProvider"
},
},
"verbose": 4,
"http_authenticator": {
......@@ -47,7 +44,8 @@ config = {
"default_to_digest": False,
# Name of a header field that will be accepted as authorized user
"trusted_auth_header": None,
}
},
"tg_host": app_config.tg_host,
}
app = WsgiDAVApp(config)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment