Skip to content
This repository was archived by the owner on May 6, 2024. It is now read-only.

Commit 4bf859c

Browse files
committed
Expand Sentry configuration
1 parent 29dd7d5 commit 4bf859c

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

templates/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,17 @@
124124
</div>
125125
</div>
126126
</div>
127+
<script src="https://cdn.ravenjs.com/3.17.0/raven.min.js"
128+
crossorigin="anonymous"></script>
129+
<script>window.SENTRY_DSN = '{{ SENTRY_DSN_FRONTEND }}';</script>
130+
<script>
131+
window.SENTRY_DSN && Raven.config(window.SENTRY_DSN, {
132+
// TODO(dcramer): make this configurable/autobind?
133+
whitelistUrls: [/zeus\.ci/],
134+
environment: '{{ SENTRY_ENVIRONMENT }}',
135+
release: '{{ SENTRY_RELEASE }}',
136+
}).install();
137+
</script>
127138
<script type="text/javascript" src="{{ url_for('static', filename='bundle.js') }}"></script>
128139
</body>
129140
</html>

zeus/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,15 @@ def create_app(_read_config=True, **config):
7070
app.config['REDIS_URL'] = REDIS_URL
7171

7272
app.config['SENTRY_DSN'] = os.environ.get('SENTRY_DSN') or None
73+
app.config['SENTRY_DSN_FRONTEND'] = os.environ.get('SENTRY_DSN_FRONTEND') or None
7374
app.config['SENTRY_INCLUDE_PATHS'] = [
7475
'zeus',
7576
]
7677
try:
7778
app.config['SENTRY_RELEASE'] = raven.fetch_git_sha(ROOT)
7879
except Exception:
7980
app.logger.warn('unable to bind sentry.release context', exc_info=True)
81+
app.config['SENTRY_ENVIRONMENT'] = os.environ.get('NODE_ENV', 'development')
8082

8183
app.config['GITHUB_CLIENT_ID'] = os.environ.get('GITHUB_CLIENT_ID') or None
8284
app.config['GITHUB_CLIENT_SECRET'] = os.environ.get('GITHUB_CLIENT_SECRET') or None

zeus/web/views/index.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
from flask import render_template
1+
from flask import current_app, render_template
22

33

44
def index(path=None):
5-
return render_template('index.html')
5+
return render_template(
6+
'index.html', **{
7+
'SENTRY_DSN_FRONTEND': current_app.config.get('SENTRY_DSN_FRONTEND') or '',
8+
'SENTRY_ENVIRONMENT': current_app.config.get('SENTRY_ENVIRONMENT') or '',
9+
'SENTRY_RELEASE': current_app.config.get('SENTRY_RELEASE') or '',
10+
}
11+
)

0 commit comments

Comments
 (0)