diff --git a/sage_mailbox/conf.py b/sage_mailbox/conf.py index 8fedd70..7b92b23 100644 --- a/sage_mailbox/conf.py +++ b/sage_mailbox/conf.py @@ -1,22 +1,17 @@ from django.conf import settings from sage_mailbox.exc import IMAPConfigurationError - -DEFAULTS = { - "IMAP_SERVER_DOMAIN": None, - "IMAP_SERVER_PORT": 993, - "IMAP_SERVER_USER": None, - "IMAP_SERVER_PASSWORD": None, - "IMAP_DEBUG_ENABLED": True, -} +from sage_mailbox.constants import DEFAULTS class IMAPSettings: + EXCLUDED_FROM_VALIDATION = ["IMAP_DEBUG_ENABLED"] + def __init__(self): self._settings = {} for setting, default in DEFAULTS.items(): value = getattr(settings, setting, default) - if value is None and setting not in ["MAILCOW_DEBUG_ENABLED"]: + if value is None and setting not in self.EXCLUDED_FROM_VALIDATION: raise IMAPConfigurationError( f"{setting} must be set in your Django settings." ) diff --git a/sage_mailbox/constants.py b/sage_mailbox/constants.py new file mode 100644 index 0000000..af8f1e9 --- /dev/null +++ b/sage_mailbox/constants.py @@ -0,0 +1,8 @@ + +DEFAULTS = { + "IMAP_SERVER_DOMAIN": None, + "IMAP_SERVER_PORT": 993, + "IMAP_SERVER_USER": None, + "IMAP_SERVER_PASSWORD": None, + "IMAP_DEBUG_ENABLED": True, +}