Skip to content

Commit 35f600d

Browse files
shubh2294manuc66
authored andcommitted
Add support for PAPERLESS_TOKEN_FILE environment variable
1 parent ce4f0b7 commit 35f600d

File tree

2 files changed

+26
-23
lines changed

2 files changed

+26
-23
lines changed

README.md

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -415,28 +415,29 @@ All scanned files are written to the volume `/scan`, the filename can be changed
415415

416416
List of supported environment variables and their meaning, or correspondence with [command-line flags](#cli-options):
417417

418-
| Environment Variable | Description | Corresponding CLI Flag or Notes |
419-
|-------------------------------|-------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|
420-
| `CMDLINE` | Additional command-line flags added at the end of the command | Set to `-D` to enable debug logs |
421-
| `DIR` | Directory to use | `-d` / `--directory` |
422-
| `IP` | IP address for the program | `-a` / `--address` |
423-
| `KEEP_FILES` | If set, scanned files are not deleted after uploading to Paperless-ngx or Nextcloud | |
424-
| `LABEL` | Label to set on the device's display as a scan target | `-l` / `--label` |
425-
| `NAME` | Name of the device to lookup for on the network | `-n` / `--name` |
426-
| `ADD_EMULATED_DUPLEX` | Enable emulated duplex scanning, with optional assembly mode (default: document-wise) | `--add-emulated-duplex [mode]` |
427-
| `NEXTCLOUD_PASSWORD` | Password of Nextcloud user (either this or `NEXTCLOUD_PASSWORD_FILE` is required; file takes precedence) | |
428-
| `NEXTCLOUD_PASSWORD_FILE` | File containing Nextcloud user password (either this or `NEXTCLOUD_PASSWORD` is required; takes precedence) | Example: `./nextcloud_password.secret` (preferred for Docker Compose secrets) |
429-
| `NEXTCLOUD_UPLOAD_FOLDER` | Upload folder for documents or images (user must have write permission; defaults to `scan` if not set) | |
430-
| `NEXTCLOUD_URL` | Nextcloud URL | Example: `https://nextcloud.example.tld` |
431-
| `NEXTCLOUD_USERNAME` | Nextcloud username | |
432-
| `PAPERLESS_POST_DOCUMENT_URL` | Paperless-ngx post document URL (if provided with token, a PDF is uploaded) | Example: `http://<paperless-host>:<port>/api/documents/post_document/` |
433-
| `PAPERLESS_TOKEN` | Paperless-ngx API token | Example: `xxxxxxxxxxxx...` |
434-
| `PATTERN` | Pattern to use | `-p` / `--pattern` |
435-
| `PGID` | ID of the group that will run the program | |
436-
| `PUID` | ID of the user that will run the program | |
437-
| `RESOLUTION` | Resolution setting | `-r` / `--resolution` |
438-
| `MODE` | Scan mode setting | `--mode` |
439-
| `TEMP_DIR` | Temporary directory | `-t` / `--temp-directory` |
418+
| Environment Variable | Description | Corresponding CLI Flag or Notes |
419+
|-------------------------------|---------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|
420+
| `CMDLINE` | Additional command-line flags added at the end of the command | Set to `-D` to enable debug logs |
421+
| `DIR` | Directory to use | `-d` / `--directory` |
422+
| `IP` | IP address for the program | `-a` / `--address` |
423+
| `KEEP_FILES` | If set, scanned files are not deleted after uploading to Paperless-ngx or Nextcloud | |
424+
| `LABEL` | Label to set on the device's display as a scan target | `-l` / `--label` |
425+
| `NAME` | Name of the device to lookup for on the network | `-n` / `--name` |
426+
| `ADD_EMULATED_DUPLEX` | Enable emulated duplex scanning, with optional assembly mode (default: document-wise) | `--add-emulated-duplex [mode]` |
427+
| `NEXTCLOUD_PASSWORD` | Password of Nextcloud user (either this or `NEXTCLOUD_PASSWORD_FILE` is required; file takes precedence) | |
428+
| `NEXTCLOUD_PASSWORD_FILE` | File containing Nextcloud user password (either this or `NEXTCLOUD_PASSWORD` is required; takes precedence) | Example: `./nextcloud_password.secret` (preferred for Docker Compose secrets) |
429+
| `NEXTCLOUD_UPLOAD_FOLDER` | Upload folder for documents or images (user must have write permission; defaults to `scan` if not set) | |
430+
| `NEXTCLOUD_URL` | Nextcloud URL | Example: `https://nextcloud.example.tld` |
431+
| `NEXTCLOUD_USERNAME` | Nextcloud username | |
432+
| `PAPERLESS_POST_DOCUMENT_URL` | Paperless-ngx post document URL (if provided with token, a PDF is uploaded) | Example: `http://<paperless-host>:<port>/api/documents/post_document/` |
433+
| `PAPERLESS_TOKEN` | Paperless-ngx API token (either this or `NEXTCLOUD_PASSWORD_FILE` is required; file takes precedence) | Example: `xxxxxxxxxxxx...` |
434+
| `PAPERLESS_TOKEN_FILE` | File containing paperless-ngx API token (either this or `PAPERLESS_TOKEN_FILE` is required; takes precedence) | Example: `./paperless_token.secret` (preferred for Docker Compose secrets) |
435+
| `PATTERN` | Pattern to use | `-p` / `--pattern` |
436+
| `PGID` | ID of the group that will run the program | |
437+
| `PUID` | ID of the user that will run the program | |
438+
| `RESOLUTION` | Resolution setting | `-r` / `--resolution` |
439+
| `MODE` | Scan mode setting | `--mode` |
440+
| `TEMP_DIR` | Temporary directory | `-t` / `--temp-directory` |
440441

441442
**Additional Notes:**
442443

root/app.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ if [ -n "$PAPERLESS_POST_DOCUMENT_URL" ]; then
6161
ARGS+=("-s" "$PAPERLESS_POST_DOCUMENT_URL")
6262
fi
6363

64-
if [ -n "$PAPERLESS_TOKEN" ]; then
64+
if [ -n "$PAPERLESS_TOKEN_FILE" ]; then
65+
ARGS+=("--paperless-token-file" "$PAPERLESS_TOKEN_FILE")
66+
elif [ -n "$PAPERLESS_TOKEN" ]; then
6567
ARGS+=("-o" "$PAPERLESS_TOKEN")
6668
fi
6769

0 commit comments

Comments
 (0)