From 7916c75768e44e0066663020158e005d95490c32 Mon Sep 17 00:00:00 2001 From: egg Date: Tue, 2 Dec 2025 17:53:34 +0800 Subject: [PATCH] fix: allow extra environment variables in pydantic-settings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add extra='ignore' to Settings Config to prevent ValidationError when .env files contain deprecated variables (e.g., PADDLEOCR_MODEL_DIR). This ensures backwards compatibility with Docker deployments. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- backend/app/core/config.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/app/core/config.py b/backend/app/core/config.py index 804c3f8..a28daad 100644 --- a/backend/app/core/config.py +++ b/backend/app/core/config.py @@ -416,6 +416,9 @@ class Settings(BaseSettings): ) env_file_encoding = "utf-8" case_sensitive = False + # Ignore extra environment variables not defined in Settings + # This allows backwards compatibility with old .env files (e.g., Docker) + extra = "ignore" def _resolve_path(self, path_value: str) -> Path: """