From 7c96a579b2e52e4072f559d9d4cf329cb8bebecc Mon Sep 17 00:00:00 2001 From: timgl Date: Thu, 21 Sep 2023 00:15:42 +0100 Subject: [PATCH] fix: Add env var for session replay --- posthog/api/decide.py | 6 ++++-- posthog/settings/web.py | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/posthog/api/decide.py b/posthog/api/decide.py index 880a62128abdc..e1edb1588dca1 100644 --- a/posthog/api/decide.py +++ b/posthog/api/decide.py @@ -215,8 +215,10 @@ def get_decide(request: HttpRequest): else False ) - if team.session_recording_opt_in and ( - on_permitted_recording_domain(team, request) or not team.recording_domains + if ( + settings.DECIDE_ALLOW_SESSION_REPLAY + and team.session_recording_opt_in + and (on_permitted_recording_domain(team, request) or not team.recording_domains) ): capture_console_logs = True if team.capture_console_log_opt_in else False response["sessionRecording"] = { diff --git a/posthog/settings/web.py b/posthog/settings/web.py index ca0c035765a7e..a0a92c560dd90 100644 --- a/posthog/settings/web.py +++ b/posthog/settings/web.py @@ -43,6 +43,9 @@ "DECIDE_SKIP_HASH_KEY_OVERRIDE_WRITES", False, type_cast=str_to_bool ) + +DECIDE_ALLOW_SESSION_REPLAY = get_from_env("DECIDE_ALLOW_SESSION_REPLAY", True, type_cast=str_to_bool) + # Application definition INSTALLED_APPS = [