Fix pydantic settings issue in config.py
This commit is contained in:
parent
3b335fce18
commit
fa080b351e
@ -1,13 +1,12 @@
|
|||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from pydantic import field_validator
|
from pydantic import field_validator, BaseModel
|
||||||
from pydantic_settings import BaseSettings
|
|
||||||
|
|
||||||
# Project directories
|
# Project directories
|
||||||
ROOT_DIR = Path(__file__).parent.parent.parent.resolve()
|
ROOT_DIR = Path(__file__).parent.parent.parent.resolve()
|
||||||
|
|
||||||
|
|
||||||
class Settings(BaseSettings):
|
class Settings(BaseModel):
|
||||||
# Project info
|
# Project info
|
||||||
PROJECT_NAME: str = "One-Time Secret Sharing Service"
|
PROJECT_NAME: str = "One-Time Secret Sharing Service"
|
||||||
API_V1_STR: str = "/api/v1"
|
API_V1_STR: str = "/api/v1"
|
||||||
@ -28,9 +27,10 @@ class Settings(BaseSettings):
|
|||||||
db_dir.mkdir(parents=True, exist_ok=True)
|
db_dir.mkdir(parents=True, exist_ok=True)
|
||||||
return db_dir
|
return db_dir
|
||||||
|
|
||||||
class Config:
|
model_config = {
|
||||||
env_file = ".env"
|
"env_file": ".env",
|
||||||
case_sensitive = True
|
"case_sensitive": True,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Create global settings instance
|
# Create global settings instance
|
||||||
|
@ -4,6 +4,7 @@ SQLAlchemy>=2.0.9
|
|||||||
alembic>=1.10.4
|
alembic>=1.10.4
|
||||||
python-dotenv>=1.0.0
|
python-dotenv>=1.0.0
|
||||||
pydantic>=2.0.0
|
pydantic>=2.0.0
|
||||||
|
pydantic-settings>=2.0.0
|
||||||
ruff>=0.0.262
|
ruff>=0.0.262
|
||||||
cryptography>=40.0.2
|
cryptography>=40.0.2
|
||||||
asyncio>=3.4.3
|
asyncio>=3.4.3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user