From 0fbaf7abb23cc336b54f9815d80c3103940d3158 Mon Sep 17 00:00:00 2001 From: Stiftung Development Date: Wed, 17 Sep 2025 22:06:01 +0200 Subject: [PATCH] URGENT: Fix production Paperless integration - Remove hardcoded fallbacks from config.py (relied on old prod values) - Add missing Paperless env vars to compose.yml for production - Update compose.dev.yml with complete Paperless configuration - Fixes 500 errors by ensuring all env vars are passed to containers Required: VPS .env must have PAPERLESS_*_TAG_ID and PAPERLESS_*_TAG variables --- app/stiftung/utils/config.py | 18 ++++++++---------- compose.dev.yml | 8 +++++++- compose.yml | 6 ++++++ 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/app/stiftung/utils/config.py b/app/stiftung/utils/config.py index 8862cb5..5f3945c 100644 --- a/app/stiftung/utils/config.py +++ b/app/stiftung/utils/config.py @@ -38,16 +38,14 @@ def get_paperless_config(): dict: Dictionary containing all Paperless configuration """ return { - "api_url": get_config("paperless_api_url", "http://192.168.178.167:30070"), - "api_token": get_config("paperless_api_token", ""), - "destinataere_tag": get_config( - "paperless_destinataere_tag", "Stiftung_Destinatäre" - ), - "destinataere_tag_id": get_config("paperless_destinataere_tag_id", "210"), - "land_tag": get_config("paperless_land_tag", "Stiftung_Land_und_Pächter"), - "land_tag_id": get_config("paperless_land_tag_id", "204"), - "admin_tag": get_config("paperless_admin_tag", "Stiftung_Administration"), - "admin_tag_id": get_config("paperless_admin_tag_id", "216"), + "api_url": get_config("paperless_api_url"), + "api_token": get_config("paperless_api_token"), + "destinataere_tag": get_config("paperless_destinataere_tag"), + "destinataere_tag_id": get_config("paperless_destinataere_tag_id"), + "land_tag": get_config("paperless_land_tag"), + "land_tag_id": get_config("paperless_land_tag_id"), + "admin_tag": get_config("paperless_admin_tag"), + "admin_tag_id": get_config("paperless_admin_tag_id"), } diff --git a/compose.dev.yml b/compose.dev.yml index ad8f802..3ee1f3c 100644 --- a/compose.dev.yml +++ b/compose.dev.yml @@ -40,7 +40,13 @@ services: - TIME_ZONE=Europe/Berlin - REDIS_URL=redis://redis:6379/0 - PAPERLESS_API_URL=http://paperless:8000 - - PAPERLESS_API_TOKEN=dev-token-will-be-set-after-paperless-setup + - PAPERLESS_API_TOKEN=d477152aca264ea00620910ac09a06f0a4faaecc + - PAPERLESS_REQUIRED_TAG=Stiftung_Destinatäre + - PAPERLESS_LAND_TAG=Stiftung_Land_und_Pächter + - PAPERLESS_ADMIN_TAG=Stiftung_Administration + - PAPERLESS_DESTINATAERE_TAG_ID=1 + - PAPERLESS_LAND_TAG_ID=3 + - PAPERLESS_ADMIN_TAG_ID=2 ports: - "8081:8000" volumes: diff --git a/compose.yml b/compose.yml index d89ebde..224f766 100644 --- a/compose.yml +++ b/compose.yml @@ -45,6 +45,12 @@ services: - REDIS_URL=${REDIS_URL} - PAPERLESS_API_URL=${PAPERLESS_API_URL} - PAPERLESS_API_TOKEN=${PAPERLESS_API_TOKEN} + - PAPERLESS_REQUIRED_TAG=${PAPERLESS_REQUIRED_TAG} + - PAPERLESS_LAND_TAG=${PAPERLESS_LAND_TAG} + - PAPERLESS_ADMIN_TAG=${PAPERLESS_ADMIN_TAG} + - PAPERLESS_DESTINATAERE_TAG_ID=${PAPERLESS_DESTINATAERE_TAG_ID} + - PAPERLESS_LAND_TAG_ID=${PAPERLESS_LAND_TAG_ID} + - PAPERLESS_ADMIN_TAG_ID=${PAPERLESS_ADMIN_TAG_ID} ports: - "8081:8000" volumes: