mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
#44: Harmonise environment variables with constant names
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user