From 77eb1f4af7d5fd453e4370370e8a6af187fd425d Mon Sep 17 00:00:00 2001 From: Benno Date: Tue, 27 Aug 2024 18:53:30 +0200 Subject: [PATCH] Disable Sentry except when explicitly enabled --- .env.test | 3 ++- Spybot2/settings.py | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.env.test b/.env.test index f018559..2da1f73 100644 --- a/.env.test +++ b/.env.test @@ -10,4 +10,5 @@ RECORDER_ENABLED=False INSECURE_COOKIES=True DJANGO_SUPERUSER_USERNAME=admin DJANGO_SUPERUSER_PASSWORD=admin -STEAM_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \ No newline at end of file +STEAM_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +SENTRY_ENABLED=False diff --git a/Spybot2/settings.py b/Spybot2/settings.py index 3583efb..9228a71 100644 --- a/Spybot2/settings.py +++ b/Spybot2/settings.py @@ -44,6 +44,7 @@ STEAM_API_KEY = env('STEAM_API_KEY') # Sentry SDK +SENTRY_ENABLED = env('SENTRY_ENABLED', False) SENTRY_DSN = env('SENTRY_DSN') # SECURITY WARNING: don't run with debug turned on in production! @@ -230,13 +231,14 @@ 'javascript_in_head': False, } -sentry_sdk.init( - dsn=SENTRY_DSN, - # Set traces_sample_rate to 1.0 to capture 100% - # of transactions for tracing. - traces_sample_rate=1.0, - # Set profiles_sample_rate to 1.0 to profile 100% - # of sampled transactions. - # We recommend adjusting this value in production. - profiles_sample_rate=1.0, -) \ No newline at end of file +if SENTRY_ENABLED: + sentry_sdk.init( + dsn=SENTRY_DSN, + # Set traces_sample_rate to 1.0 to capture 100% + # of transactions for tracing. + traces_sample_rate=1.0, + # Set profiles_sample_rate to 1.0 to profile 100% + # of sampled transactions. + # We recommend adjusting this value in production. + profiles_sample_rate=1.0, + ) \ No newline at end of file