diff --git a/allianceauth/checks.py b/allianceauth/checks.py index 7235ad8a..aae8b9c1 100644 --- a/allianceauth/checks.py +++ b/allianceauth/checks.py @@ -16,19 +16,40 @@ B = Configuration @register() def django_settings(app_configs, **kwargs) -> List[CheckMessage]: + """ + Check that Django settings are correctly configured + + :param app_configs: + :type app_configs: + :param kwargs: + :type kwargs: + :return: + :rtype: + """ + errors: List[CheckMessage] = [] + + # SITE_URL if hasattr(settings, "SITE_URL"): if settings.SITE_URL[-1] == "/": errors.append(Warning("'SITE_URL' Has a trailing slash. This may lead to incorrect links being generated by Auth.", hint="", id="allianceauth.checks.B005")) else: errors.append(Error("No 'SITE_URL' found is settings. This may lead to incorrect links being generated by Auth or Errors in 3rd party modules.", hint="", id="allianceauth.checks.B006")) + # CSRF_TRUSTED_ORIGINS if hasattr(settings, "CSRF_TRUSTED_ORIGINS") and hasattr(settings, "SITE_URL"): if settings.SITE_URL not in settings.CSRF_TRUSTED_ORIGINS: errors.append(Warning("'SITE_URL' not found in 'CSRF_TRUSTED_ORIGINS'. Auth may not load pages correctly until this is rectified.", hint="", id="allianceauth.checks.B007")) else: errors.append(Error("No 'CSRF_TRUSTED_ORIGINS' found is settings, Auth may not load pages correctly until this is rectified", hint="", id="allianceauth.checks.B008")) + # ESI_USER_CONTACT_EMAIL + if hasattr(settings, "ESI_USER_CONTACT_EMAIL"): + if settings.ESI_USER_CONTACT_EMAIL == "": + errors.append(Error("'ESI_USER_CONTACT_EMAIL' is empty. A valid email is required as maintainer contact for CCP.", hint="", id="allianceauth.checks.B009")) + else: + errors.append(Error("No 'ESI_USER_CONTACT_EMAIL' found is settings. A valid email is required as maintainer contact for CCP.", hint="", id="allianceauth.checks.B010")) + return errors