🧐(backend) adapt Sentry config

We add SENTRY_ENV var, to be able to distinguish
errors between different environments in Sentry
(staging / preprod / prod).
This commit is contained in:
Anthony LC
2024-11-13 13:26:09 +01:00
parent 14a1642fb8
commit 60a66e8783
2 changed files with 6 additions and 2 deletions
+3
View File
@@ -44,3 +44,6 @@ OIDC_AUTH_REQUEST_EXTRA_PARAMS={"acr_values": "eidas1"}
AI_BASE_URL=https://openaiendpoint.com
AI_API_KEY=password
AI_MODEL=llama
# Sentry
SENTRY_ENV=development
+3 -2
View File
@@ -372,7 +372,8 @@ class Base(Configuration):
CORS_ALLOWED_ORIGIN_REGEXES = values.ListValue([])
# Sentry
SENTRY_DSN = values.Value(None, environ_name="SENTRY_DSN")
SENTRY_DSN = values.Value(None, environ_name="SENTRY_DSN", environ_prefix=None)
SENTRY_ENV = values.Value(None, environ_name="SENTRY_ENV", environ_prefix=None)
# Easy thumbnails
THUMBNAIL_EXTENSION = "webp"
@@ -524,7 +525,7 @@ class Base(Configuration):
if cls.SENTRY_DSN is not None:
sentry_sdk.init(
dsn=cls.SENTRY_DSN,
environment=cls.__name__.lower(),
environment=cls.SENTRY_ENV or cls.__name__.lower(),
release=get_release(),
integrations=[DjangoIntegration()],
)