mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-09 09:58:20 -05:00
Drop STORAGE_TYPE in favour of just using PAPERLESS_PASSPHRASE
This commit is contained in:
parent
5643d89270
commit
6e1f2b3f03
@ -48,15 +48,9 @@ class Consumer:
|
|||||||
except FileExistsError:
|
except FileExistsError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
acceptable_storage_types = [_[0] for _ in Document.STORAGE_TYPES]
|
self.storage_type = Document.STORAGE_TYPE_UNENCRYPTED
|
||||||
if settings.STORAGE_TYPE not in acceptable_storage_types:
|
if settings.PASSPHRASE:
|
||||||
raise ConsumerError(
|
self.storage_type = Document.STORAGE_TYPE_GPG
|
||||||
'Invalid STORAGE_TYPE "{}" defined. It must be one of {}. '
|
|
||||||
'Exiting.'.format(
|
|
||||||
settings.STORAGE_TYPE,
|
|
||||||
", ".join(acceptable_storage_types)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
self.stats = {}
|
self.stats = {}
|
||||||
self._ignore = []
|
self._ignore = []
|
||||||
@ -209,7 +203,7 @@ class Consumer:
|
|||||||
checksum=hashlib.md5(f.read()).hexdigest(),
|
checksum=hashlib.md5(f.read()).hexdigest(),
|
||||||
created=created,
|
created=created,
|
||||||
modified=created,
|
modified=created,
|
||||||
storage_type=settings.STORAGE_TYPE
|
storage_type=self.storage_type
|
||||||
)
|
)
|
||||||
|
|
||||||
relevant_tags = set(list(Tag.match_all(text)) + list(file_info.tags))
|
relevant_tags = set(list(Tag.match_all(text)) + list(file_info.tags))
|
||||||
@ -231,7 +225,7 @@ class Consumer:
|
|||||||
if document.storage_type == Document.STORAGE_TYPE_UNENCRYPTED:
|
if document.storage_type == Document.STORAGE_TYPE_UNENCRYPTED:
|
||||||
write_file.write(read_file.read())
|
write_file.write(read_file.read())
|
||||||
return
|
return
|
||||||
self.log("debug", "Encrypting the thumbnail")
|
self.log("debug", "Encrypting")
|
||||||
write_file.write(GnuPG.encrypted(read_file))
|
write_file.write(GnuPG.encrypted(read_file))
|
||||||
|
|
||||||
def _cleanup_doc(self, doc):
|
def _cleanup_doc(self, doc):
|
||||||
|
@ -6,16 +6,6 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "paperless.settings")
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "paperless.settings")
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.core.management import execute_from_command_line
|
from django.core.management import execute_from_command_line
|
||||||
|
|
||||||
# The runserver and consumer need to have access to the passphrase, so it
|
|
||||||
# must be entered at start time to keep it safe.
|
|
||||||
if "runserver" in sys.argv or "document_consumer" in sys.argv:
|
|
||||||
if not settings.STORAGE_TYPE == "unencrypted":
|
|
||||||
while not settings.PASSPHRASE:
|
|
||||||
settings.PASSPHRASE = input(
|
|
||||||
"settings.PASSPHRASE is unset. Input passphrase: "
|
|
||||||
)
|
|
||||||
|
|
||||||
execute_from_command_line(sys.argv)
|
execute_from_command_line(sys.argv)
|
||||||
|
@ -251,21 +251,17 @@ CONSUMPTION_DIR = os.getenv("PAPERLESS_CONSUMPTION_DIR")
|
|||||||
# slowly, you may want to use a higher value than the default.
|
# slowly, you may want to use a higher value than the default.
|
||||||
CONSUMER_LOOP_TIME = int(os.getenv("PAPERLESS_CONSUMER_LOOP_TIME", 10))
|
CONSUMER_LOOP_TIME = int(os.getenv("PAPERLESS_CONSUMER_LOOP_TIME", 10))
|
||||||
|
|
||||||
# By default, Paperless will attempt to GPG encrypt your PDF files using the
|
# Pre-2.x versions of Paperless stored your documents locally with GPG
|
||||||
# PASSPHRASE specified below. If however you're not concerned about encrypting
|
# encryption, but that is no longer the default. This behaviour is still
|
||||||
# these files (for example if you have disk encryption locally) then
|
# available, but it must be explicitly enabled by setting
|
||||||
# you don't need this and can safely turn it off by setting STORAGE_TYPE to
|
# `PAPERLESS_PASSPHRASE` in your environment or config file. The default is to
|
||||||
# "unencrypted" here. In such a case, the PASSPHRASE value set below will be
|
# store these files unencrypted.
|
||||||
# ignored.
|
#
|
||||||
STORAGE_TYPE = os.getenv("PAPERLESS_STORAGE_TYPE", "gpg")
|
# Translation:
|
||||||
|
# * If you're a new user, you can safely ignore this setting.
|
||||||
# This is used to encrypt the original documents and decrypt them later when
|
# * If you're upgrading from 1.x, this must be set, OR you can run
|
||||||
# you want to download them. Set it and change the permissions on this file to
|
# `./manage.py change_storage_type gpg unencrypted` to decrypt your files,
|
||||||
# 0600, or set it to `None` and you'll be prompted for the passphrase at
|
# after which you can unset this value.
|
||||||
# runtime. The default looks for an environment variable.
|
|
||||||
# DON'T FORGET TO SET THIS as leaving it blank may cause some strange things
|
|
||||||
# with GPG, including an interesting case where it may "encrypt" zero-byte
|
|
||||||
# files.
|
|
||||||
PASSPHRASE = os.getenv("PAPERLESS_PASSPHRASE")
|
PASSPHRASE = os.getenv("PAPERLESS_PASSPHRASE")
|
||||||
|
|
||||||
# Trigger a script after every successful document consumption?
|
# Trigger a script after every successful document consumption?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user