From ccf2bb983b9a455b7cbb911fd72d3c8e59c46394 Mon Sep 17 00:00:00 2001 From: Automated Action Date: Mon, 2 Jun 2025 09:21:34 +0000 Subject: [PATCH] Fix Pydantic Settings validation error for extra environment variables - Added CONTENT field to Settings model with Optional type - Set extra='ignore' in Config to allow extra environment variables - Added the same config to custom BaseSettings implementation for consistency - Added missing import for Optional type --- app/core/config.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/core/config.py b/app/core/config.py index 35cae9a..9142e6b 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -1,5 +1,6 @@ import os from pathlib import Path +from typing import Optional from pydantic import BaseModel @@ -16,6 +17,7 @@ except ImportError: class Config: env_file = ".env" case_sensitive = True + extra = "ignore" # Allow extra fields from environment variables def __init__(self, **kwargs): # Load environment variables @@ -38,9 +40,13 @@ class Settings(BaseSettings): DB_DIR: Path = Path("/app") / "storage" / "db" DB_NAME: str = "db.sqlite" + # Environment variables that can be accessed via API + CONTENT: Optional[str] = None + class Config: env_file = ".env" case_sensitive = True + extra = "ignore" # Allow extra fields from environment variables settings = Settings()