Add ability to provide the configuration file path using an env variable

This commit is contained in:
hashworks 2022-12-21 22:28:16 +01:00 committed by Trenton H
parent d6e6f49c15
commit 4269074944
2 changed files with 9 additions and 8 deletions

View File

@ -10,12 +10,10 @@ run paperless, these settings have to be defined in different places.
- If you are running paperless on anything else, paperless will search - If you are running paperless on anything else, paperless will search
for the configuration file in these locations and use the first one for the configuration file in these locations and use the first one
it finds: it finds:
- The environment variable `PAPERLESS_CONFIGURATION_PATH`
``` - `/path/to/paperless/paperless.conf`
/path/to/paperless/paperless.conf - `/etc/paperless.conf`
/etc/paperless.conf - `/usr/local/etc/paperless.conf`
/usr/local/etc/paperless.conf
```
## Required services ## Required services
@ -678,7 +676,7 @@ paperless will process in parallel on a single document.
count, with a slight favor towards threads per worker: count, with a slight favor towards threads per worker:
| CPU core count | Workers | Threads | | CPU core count | Workers | Threads |
|----------------|---------|---------| | -------------- | ------- | ------- |
| > 1 | > 1 | > 1 | | > 1 | > 1 | > 1 |
| > 2 | > 2 | > 1 | | > 2 | > 2 | > 1 |
| > 4 | > 2 | > 2 | | > 4 | > 2 | > 2 |

View File

@ -17,7 +17,10 @@ from django.utils.translation import gettext_lazy as _
from dotenv import load_dotenv from dotenv import load_dotenv
# Tap paperless.conf if it's available # Tap paperless.conf if it's available
if os.path.exists("../paperless.conf"): configuration_path = os.getenv("PAPERLESS_CONFIGURATION_PATH")
if configuration_path and os.path.exists(configuration_path):
load_dotenv(configuration_path)
elif os.path.exists("../paperless.conf"):
load_dotenv("../paperless.conf") load_dotenv("../paperless.conf")
elif os.path.exists("/etc/paperless.conf"): elif os.path.exists("/etc/paperless.conf"):
load_dotenv("/etc/paperless.conf") load_dotenv("/etc/paperless.conf")