diff --git a/api/config/settings/common.py b/api/config/settings/common.py index f2323e363..1fb52fd3d 100644 --- a/api/config/settings/common.py +++ b/api/config/settings/common.py @@ -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: diff --git a/api/funkwhale_api/common/dynamic_preferences_registry.py b/api/funkwhale_api/common/dynamic_preferences_registry.py index 4733d3a18..495e2bebd 100644 --- a/api/funkwhale_api/common/dynamic_preferences_registry.py +++ b/api/funkwhale_api/common/dynamic_preferences_registry.py @@ -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 "