Skip to content

Commit

Permalink
Merge pull request #3600 from webkom/staging-statistics
Browse files Browse the repository at this point in the history
Disable logging if analytics key is not set
  • Loading branch information
norbye authored May 19, 2024
2 parents aeb6405 + 01501cc commit f05b31f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lego/apps/stats/analytics_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ def setup_analytics():
write_key = getattr(settings, "ANALYTICS_WRITE_KEY", "")
host = getattr(settings, "ANALYTICS_HOST", "https://api.segment.io")

if write_key == "":
return

production = getattr(settings, "ENVIRONMENT_NAME", None) == "production"
send = not (development or getattr(settings, "TESTING", False)) or production

Expand All @@ -36,6 +39,9 @@ def setup_analytics():
def _proxy(method, user, *args, **kwargs):
global default_client, development

if default_client is None:
return

fn = getattr(default_client, method)

kwargs["context"] = {
Expand Down

0 comments on commit f05b31f

Please sign in to comment.