File tree Expand file tree Collapse file tree 4 files changed +13
-19
lines changed
Expand file tree Collapse file tree 4 files changed +13
-19
lines changed Original file line number Diff line number Diff line change 11"""Configuration settings for Ollama Proxy Server."""
22
3+ from pydantic import ConfigDict
34from pydantic_settings import BaseSettings
45
56
67class Settings (BaseSettings ):
78 """Bootstrap settings for the application."""
89
10+ model_config = ConfigDict (
11+ env_file = ".env" ,
12+ case_sensitive = True ,
13+ # extra="ignore",
14+ extra = "forbid" ,
15+ )
16+
917 # --- Bootstrap Settings ---
1018 # These are the only settings read from the .env file.
1119 DATABASE_URL : str = "sqlite+aiosqlite:///./ollama_proxy.db"
@@ -20,14 +28,6 @@ class Settings(BaseSettings):
2028 LOG_LEVEL : str = "info"
2129
2230
23- class Config : # pylint: disable=too-few-public-methods
24- """Pydantic configuration."""
25-
26- env_file = ".env"
27- case_sensitive = True
28- extra = "ignore" # <-- THIS IS THE FIX
29-
30-
3131# This `settings` object is now only used for bootstrapping.
3232# The rest of the app will use settings loaded from the DB.
3333settings = Settings ()
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ async def init_db():
7070
7171 # Then create any missing tables
7272 async with engine .begin () as conn :
73- await conn .run_sync (Base .metadata .create_all )
73+ await conn .run_sync (Base .metadata .create_all , checkfirst = True )
7474
7575 _db_initialized = True
7676 logger .info ("Database schema is ready." )
Original file line number Diff line number Diff line change 22
33import datetime
44
5- from pydantic import BaseModel
5+ from pydantic import BaseModel , ConfigDict
66
77
88class APIKeyBase (BaseModel ):
@@ -25,7 +25,4 @@ class APIKey(APIKeyBase):
2525 is_revoked : bool
2626 created_at : datetime .datetime
2727
28- class Config : # pylint: disable=too-few-public-methods
29- """Pydantic configuration."""
30-
31- from_attributes = True
28+ model_config = ConfigDict (extra = "forbid" )
Original file line number Diff line number Diff line change 11"""User schemas for Ollama Proxy Server."""
22
3- from pydantic import BaseModel
3+ from pydantic import BaseModel , ConfigDict
44
55
66class UserBase (BaseModel ):
@@ -22,7 +22,4 @@ class User(UserBase):
2222 is_active : bool
2323 is_admin : bool
2424
25- class Config : # pylint: disable=too-few-public-methods
26- """Pydantic configuration."""
27-
28- from_attributes = True
25+ model_config = ConfigDict (extra = "forbid" )
You can’t perform that action at this time.
0 commit comments