Skip to content

Commit

Permalink
fix: check if Meilisearch is enabled before return client
Browse files Browse the repository at this point in the history
Co-authored-by: Yusuf Musleh <[email protected]>
  • Loading branch information
rpenido and yusuf-musleh authored Mar 20, 2024
1 parent 10336c1 commit 9723d75
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions openedx/core/djangoapps/content/search/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ def _get_meilisearch_client():
"""
global _MEILI_CLIENT # pylint: disable=global-statement

if _MEILI_CLIENT is not None:
return _MEILI_CLIENT

# Connect to Meilisearch
if not settings.MEILISEARCH_ENABLED:
raise RuntimeError("MEILISEARCH_ENABLED is not set - search functionality disabled.")

if _MEILI_CLIENT is not None:
return _MEILI_CLIENT

_MEILI_CLIENT = meilisearch.Client(settings.MEILISEARCH_URL, settings.MEILISEARCH_API_KEY)
try:
Expand Down

0 comments on commit 9723d75

Please sign in to comment.