diff --git a/config.env.py b/config.env.py index bad55c23..02125fad 100644 --- a/config.env.py +++ b/config.env.py @@ -46,6 +46,9 @@ ONESIGNAL_INTRO_APP_AUTH_KEY = environ.get("PACKET_ONESIGNAL_INTRO_APP_AUTH_KEY", None) ONESIGNAL_INTRO_APP_ID = environ.get("PACKET_ONESIGNAL_INTRO_APP_ID", "6eff123a-0852-4027-804e-723044756f00") +# Sentry Config +SENTRY_DSN = environ.get("PACKET_SENTRY_DSN", "") + # Slack URL for pushing to #general SLACK_WEBHOOK_URL = environ.get("PACKET_SLACK_URL", None) diff --git a/packet/__init__.py b/packet/__init__.py index 25189c44..7341a8eb 100644 --- a/packet/__init__.py +++ b/packet/__init__.py @@ -2,9 +2,9 @@ The application setup and initialization code lives here """ -import os -import logging import json +import logging +import os import csh_ldap import onesignal @@ -15,6 +15,9 @@ from flask_pyoidc.provider_configuration import ProviderConfiguration, ClientMetadata from flask_sqlalchemy import SQLAlchemy +import sentry_sdk +from sentry_sdk.integrations.flask import FlaskIntegration + app = Flask(__name__) gzip = Gzip(app) @@ -60,6 +63,12 @@ # LDAP _ldap = csh_ldap.CSHLDAP(app.config['LDAP_BIND_DN'], app.config['LDAP_BIND_PASS']) +# Sentry +sentry_sdk.init( + dsn=app.config['SENTRY_DSN'], + integrations=[FlaskIntegration()] +) + app.logger.info('OIDCAuth and LDAP configured') # pylint: disable=wrong-import-position diff --git a/requirements.txt b/requirements.txt index 5687c98f..38f5f3f1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,4 @@ gunicorn~=19.7.1 csh_ldap~=2.1.0 onesignal-sdk~=1.0.0 pylint-quotes~=0.2.1 +sentry-sdk[flask]==0.13.1