mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
#44: Harmonise environment variables with constant names
This commit is contained in:
parent
7d1aa1175f
commit
26c3781350
@ -3,6 +3,7 @@ Changelog
|
||||
|
||||
* 0.1.1 (master)
|
||||
|
||||
* `#44`_: Harmonise environment variable names with constant names.
|
||||
* `#60`_: Setup logging to actually use the Python native logging framework.
|
||||
* `#53`_: Fixed an annoying bug that caused ``.jpeg`` and ``.JPG`` images
|
||||
to be imported but made unavailable.
|
||||
@ -68,6 +69,7 @@ Changelog
|
||||
.. _darkmatter: https://github.com/darkmatter
|
||||
.. _zedster: https://github.com/zedster
|
||||
|
||||
.. _#44: https://github.com/danielquinn/paperless/issues/44
|
||||
.. _#45: https://github.com/danielquinn/paperless/issues/45
|
||||
.. _#47: https://github.com/danielquinn/paperless/issues/47
|
||||
.. _#48: https://github.com/danielquinn/paperless/issues/48
|
||||
|
@ -14,7 +14,7 @@ from .consumer import Consumer
|
||||
|
||||
class UploadForm(forms.Form):
|
||||
|
||||
SECRET = settings.UPLOAD_SHARED_SECRET
|
||||
SECRET = settings.SHARED_SECRET
|
||||
TYPE_LOOKUP = {
|
||||
"application/pdf": Document.TYPE_PDF,
|
||||
"image/png": Document.TYPE_PNG,
|
||||
|
@ -44,7 +44,7 @@ class Message(Loggable):
|
||||
and n attachments, and that we don't care about the message body.
|
||||
"""
|
||||
|
||||
SECRET = settings.UPLOAD_SHARED_SECRET
|
||||
SECRET = settings.SHARED_SECRET
|
||||
|
||||
def __init__(self, data, group=None):
|
||||
"""
|
||||
@ -175,7 +175,7 @@ class MailFetcher(Loggable):
|
||||
# Reset the grouping id for each fetch
|
||||
self.logging_group = uuid.uuid4()
|
||||
|
||||
self.log("info", "Checking mail")
|
||||
self.log("debug", "Checking mail")
|
||||
|
||||
for message in self._get_messages():
|
||||
|
||||
|
@ -159,7 +159,7 @@ LOGGING = {
|
||||
}
|
||||
|
||||
|
||||
# Paperless-specific stuffs
|
||||
# Paperless-specific stuff
|
||||
# Change these paths if yours are different
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
@ -173,19 +173,19 @@ OCR_THREADS = os.getenv("PAPERLESS_OCR_THREADS")
|
||||
# If this is true, any failed attempts to OCR a PDF will result in the PDF
|
||||
# being indexed anyway, with whatever we could get. If it's False, the file
|
||||
# will simply be left in the CONSUMPTION_DIR.
|
||||
FORGIVING_OCR = True
|
||||
FORGIVING_OCR = bool(os.getenv("PAPERLESS_FORGIVING_OCR", "YES").lower() in ("yes", "y", "1", "t", "true"))
|
||||
|
||||
# GNUPG needs a home directory for some reason
|
||||
GNUPG_HOME = os.getenv("HOME", "/tmp")
|
||||
|
||||
# Convert is part of the Imagemagick package
|
||||
CONVERT_BINARY = "/usr/bin/convert"
|
||||
# Convert is part of the ImageMagick package
|
||||
CONVERT_BINARY = os.getenv("PAPERLESS_CONVERT_BINARY")
|
||||
|
||||
# This will be created if it doesn't exist
|
||||
SCRATCH_DIR = "/tmp/paperless"
|
||||
SCRATCH_DIR = os.getenv("PAPERLESS_SCRATCH_DIR", "/tmp/paperless")
|
||||
|
||||
# This is where Paperless will look for PDFs to index
|
||||
CONSUMPTION_DIR = os.getenv("PAPERLESS_CONSUME")
|
||||
CONSUMPTION_DIR = os.getenv("PAPERLESS_CONSUMPTION_DIR")
|
||||
|
||||
# If you want to use IMAP mail consumption, populate this with useful values.
|
||||
# If you leave HOST set to None, we assume you're not going to use this
|
||||
@ -211,4 +211,37 @@ PASSPHRASE = os.getenv("PAPERLESS_PASSPHRASE")
|
||||
# If you intend to use the "API" to push files into the consumer, you'll need
|
||||
# to provide a shared secret here. Leaving this as the default will disable
|
||||
# the API.
|
||||
UPLOAD_SHARED_SECRET = os.getenv("PAPERLESS_SECRET", "")
|
||||
SHARED_SECRET = os.getenv("PAPERLESS_SHARED_SECRET", "")
|
||||
|
||||
#
|
||||
# TODO: Remove after 1.2
|
||||
#
|
||||
# This logic is here to address issue #44, wherein we were using inconsistent
|
||||
# constant names vs. environment variables. If you're using Paperless for the
|
||||
# first time, you can safely ignore everything from here on, so long as you're
|
||||
# correctly defining the variables as per the documentation.
|
||||
#
|
||||
|
||||
|
||||
def deprecated(before, after):
|
||||
print(
|
||||
"\n\n"
|
||||
"WARNING: {before} has been renamed to {after}.\n"
|
||||
"WARNING: Use of {before} will not work as of version 1.2."
|
||||
"\n\n".format(
|
||||
before=before,
|
||||
after=after
|
||||
)
|
||||
)
|
||||
|
||||
if not CONVERT_BINARY:
|
||||
deprecated("PAPERLESS_CONVERT", "PAPERLESS_CONVERT_BINARY")
|
||||
CONVERT_BINARY = os.getenv("PAPERLESS_CONVERT", "convert")
|
||||
|
||||
if not CONSUMPTION_DIR and os.getenv("PAPERLESS_CONSUME"):
|
||||
deprecated("PAPERLESS_CONSUME", "PAPERLESS_CONSUMPTION_DIR")
|
||||
CONSUMPTION_DIR = os.getenv("PAPERLESS_CONSUME")
|
||||
|
||||
if not SHARED_SECRET and os.getenv("PAPERLESS_SECRET"):
|
||||
deprecated("PAPERLESS_SECRET", "PAPERLESS_SHARED_SECRET")
|
||||
SHARED_SECRET = os.getenv("PAPERLESS_SECRET", "")
|
||||
|
@ -47,5 +47,5 @@ urlpatterns = [
|
||||
|
||||
] + static.static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
if settings.UPLOAD_SHARED_SECRET:
|
||||
if settings.SHARED_SECRET:
|
||||
urlpatterns.insert(0, url(r"^push$", PushView.as_view(), name="push"))
|
||||
|
@ -1 +1 @@
|
||||
__version__ = (0, 1, 0)
|
||||
__version__ = (0, 1, 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user