Skip to content

Commit 64ef18c

Browse files
authored
Merge pull request #192 from devinmatte/sentry
Adding sentry config
2 parents 772425f + 9ea0db1 commit 64ef18c

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

config.env.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
ONESIGNAL_INTRO_APP_AUTH_KEY = environ.get("PACKET_ONESIGNAL_INTRO_APP_AUTH_KEY", None)
4747
ONESIGNAL_INTRO_APP_ID = environ.get("PACKET_ONESIGNAL_INTRO_APP_ID", "6eff123a-0852-4027-804e-723044756f00")
4848

49+
# Sentry Config
50+
SENTRY_DSN = environ.get("PACKET_SENTRY_DSN", "")
51+
4952
# Slack URL for pushing to #general
5053
SLACK_WEBHOOK_URL = environ.get("PACKET_SLACK_URL", None)
5154

packet/__init__.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
The application setup and initialization code lives here
33
"""
44

5-
import os
6-
import logging
75
import json
6+
import logging
7+
import os
88

99
import csh_ldap
1010
import onesignal
@@ -15,6 +15,9 @@
1515
from flask_pyoidc.provider_configuration import ProviderConfiguration, ClientMetadata
1616
from flask_sqlalchemy import SQLAlchemy
1717

18+
import sentry_sdk
19+
from sentry_sdk.integrations.flask import FlaskIntegration
20+
1821
app = Flask(__name__)
1922
gzip = Gzip(app)
2023

@@ -60,6 +63,12 @@
6063
# LDAP
6164
_ldap = csh_ldap.CSHLDAP(app.config['LDAP_BIND_DN'], app.config['LDAP_BIND_PASS'])
6265

66+
# Sentry
67+
sentry_sdk.init(
68+
dsn=app.config['SENTRY_DSN'],
69+
integrations=[FlaskIntegration()]
70+
)
71+
6372
app.logger.info('OIDCAuth and LDAP configured')
6473

6574
# pylint: disable=wrong-import-position

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ gunicorn~=19.7.1
1010
csh_ldap~=2.1.0
1111
onesignal-sdk~=1.0.0
1212
pylint-quotes~=0.2.1
13+
sentry-sdk[flask]==0.13.1

0 commit comments

Comments
 (0)