Skip to content

Commit

Permalink
Add new sentry JS setup
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolas committed Oct 11, 2024
1 parent 5bf843f commit 2386cd8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 25 deletions.
1 change: 1 addition & 0 deletions metricsmentor/settings_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@


if 'integrationserver' in sys.argv:
ENVIRONMENT = 'testing'
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = False
PASSWORD_HASHERS = (
Expand Down
26 changes: 2 additions & 24 deletions metricsmentor/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
<meta property="og:url" content="" />
<meta property="og:site_name" content="Metrics Mentor" />

{% include "ctlsettings/sentry_js.html" %}

<!-- JSON Structured data -->
<script type="application/ld+json">
{
Expand Down Expand Up @@ -149,30 +151,6 @@
<script src="{{STATIC_URL}}js/lib/jquery-3.6.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>

{% if SENTRY_PUBLIC_DSN %}
<script
src="https://browser.sentry-cdn.com/5.7.1/bundle.min.js"
integrity="sha384-KMv6bBTABABhv0NI+rVWly6PIRvdippFEgjpKyxUcpEmDWZTkDOiueL5xW+cztZZ"
crossorigin="anonymous"></script>

<script>
Sentry.init({
dsn: '{{ SENTRY_PUBLIC_DSN }}'
});
{% if user.is_anonymous %}
Sentry.setUser({
email: 'none',
id: 'anonymous'
});
{% else %}
Sentry.setUser({
email: '{{ user.email }}',
id: '{{ user.username }}'
});
{% endif %}
</script>
{% endif %}

{% block js %}{% endblock %}

{% if STAGING_ENV %}
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ django-flatblocks==1.0.0
djangorestframework==3.15.0

django-storages==1.14
ctlsettings==0.3.4
ctlsettings==0.4.1

django-reversion==5.1.0
text_unidecode==1.3
Expand Down

0 comments on commit 2386cd8

Please sign in to comment.