mirror of
https://github.com/bugsink/bugsink.git
synced 2026-01-30 01:20:08 -06:00
Add system-check for EVENT_STORAGES setting
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user