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