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

feat(main): init sentry very early if dsn is set

also, default wsgi config "host" to "localhost" and "port" to "8080" if unset; remove "simple_dc" config
parent 4cebb95a
No related branches found
No related tags found
1 merge request!2Resolve "track errors with sentry"
"""Configure and start the WSGI DAV Server."""
import logging import logging
import os import os
import sentry_sdk
from cheroot import wsgi from cheroot import wsgi
from wsgidav.wsgidav_app import WsgiDAVApp 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, logging.basicConfig(level=logging.DEBUG,
format='%(name)s %(levelname)s %(asctime)s %(message)s') format='%(name)s %(levelname)s %(asctime)s %(message)s')
...@@ -19,20 +30,14 @@ TMP_logger.setLevel(logging.WARNING) ...@@ -19,20 +30,14 @@ TMP_logger.setLevel(logging.WARNING)
# 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"), "host": os.getenv("host") or "localhost",
"port": int(os.getenv("port")), "port": int(os.getenv("port") or "8080"),
"provider_mapping": { "provider_mapping": {
"/": {"provider": "repdav.textgrid_dav_provider.TextgridResourceProvider"}, "/": {"provider": "repdav.textgrid_dav_provider.TextgridResourceProvider"},
}, },
"verbose": 1, "verbose": 1,
"simple_dc": {
"user_mapping": {
"*": {
"user": {
"password": "pass"}}
}
},
"http_authenticator": { "http_authenticator": {
"domain_controller": "repdav.textgrid_domain_controller.TextgridDC", "domain_controller": "repdav.textgrid_domain_controller.TextgridDC",
"accept_basic": True, # Allow basic authentication, True or False "accept_basic": True, # Allow basic authentication, True or False
......
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