From 0559204be450b180b7ca5997869c4f30df2cc3a3 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Mon, 21 May 2018 12:11:56 +0200 Subject: [PATCH] fixup: require usage of PAPERLESS_EMAIL_SECRET --- src/documents/mail.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/documents/mail.py b/src/documents/mail.py index 9a1c792aa..afa1b4362 100644 --- a/src/documents/mail.py +++ b/src/documents/mail.py @@ -42,7 +42,7 @@ class Message(Loggable): and n attachments, and that we don't care about the message body. """ - SECRET = os.getenv("PAPERLESS_EMAIL_SECRET", "") + SECRET = os.getenv("PAPERLESS_EMAIL_SECRET") def __init__(self, data, group=None): """ @@ -162,6 +162,8 @@ class MailFetcher(Loggable): self._inbox = os.getenv("PAPERLESS_CONSUME_MAIL_INBOX", "INBOX") self._enabled = bool(self._host) + if self._enabled and Message.SECRET is None: + raise MailFetcherError("No PAPERLESS_EMAIL_SECRET defined") self.last_checked = time.time() self.consume = consume