From a22b3bbb4a4e2644033c4a6e968c58a4d698bc21 Mon Sep 17 00:00:00 2001 From: James Murdza Date: Mon, 11 Aug 2025 10:34:16 -0400 Subject: [PATCH] Simplify configuration code --- libs/python/core/core/telemetry/posthog.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/libs/python/core/core/telemetry/posthog.py b/libs/python/core/core/telemetry/posthog.py index 3ba91292..bbc3c137 100644 --- a/libs/python/core/core/telemetry/posthog.py +++ b/libs/python/core/core/telemetry/posthog.py @@ -46,14 +46,6 @@ class PostHogTelemetryClient: not in {"1", "true", "yes", "on"} ) - @staticmethod - def _get_posthog_config() -> dict: - """Return PostHog configuration for anonymous telemetry (public credentials).""" - logger.debug("Using public PostHog configuration (from class method)") - return { - "api_key": PUBLIC_POSTHOG_API_KEY, - "host": PUBLIC_POSTHOG_HOST, - } # ------------------------------------------------------------------ # Public helpers @@ -73,12 +65,10 @@ class PostHogTelemetryClient: if self.initialized: return True - posthog_config = self._get_posthog_config() - try: - # Initialize the PostHog client - posthog.api_key = posthog_config["api_key"] - posthog.host = posthog_config["host"] + # Allow overrides from environment for testing/region control + posthog.api_key = PUBLIC_POSTHOG_API_KEY + posthog.host = PUBLIC_POSTHOG_HOST # Configure the client posthog.debug = os.environ.get("CUA_TELEMETRY_DEBUG", "").lower() == "on"