Refine API key validation in task configuration.

Previously, an "example key" could mistakenly pass the check, leading to potential misuse. This update ensures features are disabled if the API key is invalid or set to default.
This commit is contained in:
Egor Pavlovich Gorbunov 2025-05-06 17:57:35 +03:00
parent ce66513488
commit 7d6eb8a27a

View file

@ -156,7 +156,7 @@ def process_promotions() -> tuple[bool, str]:
element is a message describing the operation's outcome.
:rtype: tuple[bool, str]
"""
if not config.ABSTRACT_API_KEY:
if not config.ABSTRACT_API_KEY or config.ABSTRACT_API_KEY == "example key":
return False, "Abstract features disabled."
Promotion.objects.all().update(is_active=False)