diff --git a/bsmain/__init__.py b/bsmain/__init__.py index b6e6b0f..35506e7 100644 --- a/bsmain/__init__.py +++ b/bsmain/__init__.py @@ -2,6 +2,7 @@ from django.core.checks import Warning, register from django.conf import settings from bugsink.app_settings import get_settings +from events.storage_registry import get_write_storage @register("bsmain") @@ -14,3 +15,18 @@ def check_no_nested_settings_in_unnested_form(app_configs, **kwargs): f"'BUGSINK' setting." )) return errors + + +@register("bsmain") +def check_event_storage_properly_configured(app_configs, **kwargs): + errors = [] + try: + # rather than doing an explicit check, we just run the `get_write_storage` code and see if it throws an error + # get_write_storage() touches the whole storage system, so if it fails, we know something is wrong + get_write_storage() + except ValueError as e: + errors.append(Warning( + str(e), + id="bsmain.W002", + )) + return errors