feat(back):APIAutenticationRequired configure though env var

develop
Petitminion 2025-09-02 12:09:09 +02:00
rodzic 43c22677cc
commit 11fa0e10c3
2 zmienionych plików z 4 dodań i 1 usunięć

Wyświetl plik

@ -1237,6 +1237,8 @@ Example:
- ``signup=5/d,password-reset=2/d,anonymous-reports=5/d``
"""
API_AUTHENTICATION_REQUIRED = env.bool("API_AUTHENTICATION_REQUIRED", default=False)
"""used by APIAutenticationRequired to allow or not access without authentication"""
BROWSABLE_API_ENABLED = env.bool("BROWSABLE_API_ENABLED", default=False)
if BROWSABLE_API_ENABLED:

Wyświetl plik

@ -1,3 +1,4 @@
from django.conf import settings
from dynamic_preferences import types
from dynamic_preferences.registries import global_preferences_registry
@ -9,7 +10,7 @@ class APIAutenticationRequired(types.BooleanPreference):
section = common
name = "api_authentication_required"
verbose_name = "API Requires authentication"
default = True
default = settings.API_AUTHENTICATION_REQUIRED
help_text = (
"If disabled, anonymous users will be able to query the API "
"and access music data (as well as other data exposed in the API "