diff --git a/posthog/api/hog_function.py b/posthog/api/hog_function.py index 03390596a7c627..1f67756e497c0e 100644 --- a/posthog/api/hog_function.py +++ b/posthog/api/hog_function.py @@ -190,7 +190,7 @@ def validate(self, attrs): attrs["inputs"] = attrs.get("inputs") or {} if hog_type == "transformation": - if not settings.HOG_TRANSFORMATIONS_ENABLED: + if not settings.HOG_TRANSFORMATIONS_CUSTOM_HOG_ENABLED: if not template: raise serializers.ValidationError( {"template_id": "Transformation functions must be created from a template."} diff --git a/posthog/api/test/test_hog_function.py b/posthog/api/test/test_hog_function.py index aa14418e3bf559..ba4f8500b5572e 100644 --- a/posthog/api/test/test_hog_function.py +++ b/posthog/api/test/test_hog_function.py @@ -1264,7 +1264,7 @@ def create(payload): } ) - @override_settings(HOG_TRANSFORMATIONS_ENABLED=False) + @override_settings(HOG_TRANSFORMATIONS_CUSTOM_HOG_ENABLED=False) def test_transformation_functions_require_template_when_disabled(self): response = self.client.post( f"/api/projects/{self.team.id}/hog_functions/", @@ -1283,13 +1283,13 @@ def test_transformation_functions_require_template_when_disabled(self): "attr": "template_id", } - @override_settings(HOG_TRANSFORMATIONS_ENABLED=False) + @override_settings(HOG_TRANSFORMATIONS_CUSTOM_HOG_ENABLED=False) def test_transformation_functions_preserve_template_code_when_disabled(self): with patch("posthog.api.hog_function_template.HogFunctionTemplates.template") as mock_template: mock_template.return_value = template_slack # Use existing template instead of creating mock # First create with transformations enabled - with override_settings(HOG_TRANSFORMATIONS_ENABLED=True): + with override_settings(HOG_TRANSFORMATIONS_CUSTOM_HOG_ENABLED=True): response = self.client.post( f"/api/projects/{self.team.id}/hog_functions/", data={ diff --git a/posthog/settings/web.py b/posthog/settings/web.py index e3f0d6428071f3..3a0be90a763fa7 100644 --- a/posthog/settings/web.py +++ b/posthog/settings/web.py @@ -418,4 +418,6 @@ def static_varies_origin(headers, path, url): REMOTE_CONFIG_CDN_PURGE_DOMAINS = get_list(os.getenv("REMOTE_CONFIG_CDN_PURGE_DOMAINS", "")) # Whether to allow modification of transformation code -HOG_TRANSFORMATIONS_ENABLED = get_from_env("HOG_TRANSFORMATIONS_ENABLED", False, type_cast=str_to_bool) +HOG_TRANSFORMATIONS_CUSTOM_HOG_ENABLED = get_from_env( + "HOG_TRANSFORMATIONS_CUSTOM_HOG_ENABLED", False, type_cast=str_to_bool +)