From ec248dcae61ac435b8ce7c7867d18f3ce9d859b1 Mon Sep 17 00:00:00 2001 From: Son NK Date: Wed, 5 Feb 2020 14:38:29 +0700 Subject: [PATCH] use another sentry project for the front-end using SENTRY_FRONT_END_DSN param --- app/config.py | 3 +++ example.env | 4 ++++ server.py | 8 +++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/config.py b/app/config.py index 4fa15910..ad3ec06e 100644 --- a/app/config.py +++ b/app/config.py @@ -39,6 +39,9 @@ print(">>> URL:", URL) SENTRY_DSN = os.environ.get("SENTRY_DSN") +# can use another sentry project for the front-end to avoid noises +SENTRY_FRONT_END_DSN = os.environ.get("SENTRY_FRONT_END_DSN") or SENTRY_DSN + # Email related settings NOT_SEND_EMAIL = "NOT_SEND_EMAIL" in os.environ EMAIL_DOMAIN = os.environ["EMAIL_DOMAIN"] diff --git a/example.env b/example.env index be231957..ce0b5eb9 100644 --- a/example.env +++ b/example.env @@ -4,6 +4,10 @@ URL=http://localhost:7777 # If you want to enable sentry for error tracking, put your sentry dsn here. # SENTRY_DSN=your_sentry_dsn +# Possible to use another sentry project for the front-end to avoid noises +# If not set, fallback to SENTRY_DSN +# SENTRY_FRONT_END_DSN=your_sentry_dsn + # apply colored log to facilitate local development # COLOR_LOG=true diff --git a/server.py b/server.py index 18d45571..002fbddf 100644 --- a/server.py +++ b/server.py @@ -28,6 +28,7 @@ from app.config import ( RESET_DB, FLASK_PROFILER_PATH, FLASK_PROFILER_PASSWORD, + SENTRY_FRONT_END_DSN, ) from app.dashboard.base import dashboard_bp from app.developer.base import developer_bp @@ -301,7 +302,12 @@ def jinja2_filter(app): @app.context_processor def inject_stage_and_region(): - return dict(YEAR=arrow.now().year, URL=URL, SENTRY_DSN=SENTRY_DSN, VERSION=SHA1) + return dict( + YEAR=arrow.now().year, + URL=URL, + SENTRY_DSN=SENTRY_FRONT_END_DSN, + VERSION=SHA1, + ) def setup_paddle_callback(app: Flask):