Skip to content

Commit

Permalink
fix: respond with 404 when ENTERPRISE_ALGOLIA_SEARCH_API_KEY isn't set
Browse files Browse the repository at this point in the history
Co-authored-by: Piotr Surowiec <[email protected]>
  • Loading branch information
0x29a and Agrendalath authored Nov 17, 2023
1 parent f020fd8 commit c5d2ee7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion enterprise/api/v1/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,9 @@ def algolia_key(self, request, *args, **kwargs):
"""

if not (api_key := getattr(settings, "ENTERPRISE_ALGOLIA_SEARCH_API_KEY", "")):
return Response("Algolia API key not configured", status=status.HTTP_500_INTERNAL_SERVER_ERROR)
LOGGER.warning("Algolia search API key is not configured. To enable this view, "
"set `ENTERPRISE_ALGOLIA_SEARCH_API_KEY` in settings.")
raise Http404

queryset = self.queryset.filter(
**{
Expand Down

0 comments on commit c5d2ee7

Please sign in to comment.