forked from Github-Mirrors/canaille
Sentry support
This commit is contained in:
parent
dc138a7dde
commit
59a8ba1014
3 changed files with 15 additions and 0 deletions
|
@ -23,6 +23,14 @@ from .ldaputils import LDAPObjectHelper
|
|||
from .oauth2utils import config_oauth
|
||||
from .models import User
|
||||
|
||||
try: # pragma: no cover
|
||||
import sentry_sdk
|
||||
from sentry_sdk.integrations.flask import FlaskIntegration
|
||||
|
||||
SENTRY = True
|
||||
except Exception:
|
||||
SENTRY = False
|
||||
|
||||
|
||||
def create_app(config=None):
|
||||
app = Flask(__name__)
|
||||
|
@ -90,6 +98,9 @@ def setup_dev_keypair(app):
|
|||
def setup_app(app):
|
||||
app.url_map.strict_slashes = False
|
||||
|
||||
if SENTRY and app.config.get("SENTRY_DSN"):
|
||||
sentry_sdk.init(dsn=app.config["SENTRY_DSN"], integrations=[FlaskIntegration()])
|
||||
|
||||
base = app.config["LDAP"]["USER_BASE"]
|
||||
if base.endswith(app.config["LDAP"]["ROOT_DN"]):
|
||||
base = base[: -len(app.config["LDAP"]["ROOT_DN"]) - 1]
|
||||
|
|
|
@ -15,6 +15,9 @@ NAME = "MyDomain"
|
|||
OAUTH2_METADATA_FILE = "oidc_ldap_bridge/conf/oauth-authorization-server.json"
|
||||
OIDC_METADATA_FILE = "oidc_ldap_bridge/conf/openid-configuration.json"
|
||||
|
||||
# If you have a sentry instance, you can set its dsn here:
|
||||
# SENTRY_DSN = "https://examplePublicKey@o0.ingest.sentry.io/0"
|
||||
|
||||
[LDAP]
|
||||
URI = "ldap://ldap"
|
||||
ROOT_DN = "dc=mydomain,dc=tld"
|
||||
|
|
|
@ -24,6 +24,7 @@ install_requires =
|
|||
flask-babel
|
||||
flask-wtf
|
||||
python-ldap
|
||||
sentry-sdk[flask]
|
||||
toml
|
||||
|
||||
[options.packages.find]
|
||||
|
|
Loading…
Reference in a new issue