diff --git a/.vscode/tasks.json b/.vscode/tasks.json index c4eb46b..4e08857 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -26,5 +26,22 @@ "problemMatcher": [ "$python" ] - } ] + }, + { + "label": "AutoPEP8 Check", + "type": "shell", + "command": "uv run autopep8 app/**/*.py --diff", + "problemMatcher": [ + "$python" + ] + }, + { + "label": "AutoPEP8 Fix", + "type": "shell", + "command": "uv run autopep8 app/**/*.py --in-place", + "problemMatcher": [ + "$python" + ] + } + ] } \ No newline at end of file diff --git a/app/core/config.py b/app/core/config.py index 301bbe5..eec9650 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -6,28 +6,29 @@ from pydantic_settings import BaseSettings class Settings(BaseSettings): """Application settings following 12-factor app principles.""" - + # Server settings host: str = Field(default="0.0.0.0", alias="HOST") port: int = Field(default=8000, alias="PORT") debug: bool = Field(default=False, alias="DEBUG") log_level: str = Field(default="INFO", alias="LOG_LEVEL") - + # Database settings oracle_user: str = Field(alias="ORACLE_USER") oracle_password: str = Field(alias="ORACLE_PASSWORD") oracle_dsn: str = Field(alias="ORACLE_DSN") - + # Sentry settings sentry_dsn: str | None = Field(default=None, alias="SENTRY_DSN") - + # Datadog settings dd_service: str = Field(default="loapi", alias="DD_SERVICE") dd_env: str = Field(default="development", alias="DD_ENV") dd_version: str = Field(default="1.0.0", alias="DD_VERSION") - + class Config: env_file = ".env" case_sensitive = False + settings = Settings() # type:ignore[call-arg] diff --git a/app/core/database.py b/app/core/database.py index 347cffe..f04ba9c 100644 --- a/app/core/database.py +++ b/app/core/database.py @@ -39,7 +39,7 @@ def get_db() -> Generator[Session, None]: class DatabaseService: """Database service for health checks and utilities.""" - + @staticmethod def health_check() -> bool: """Check database connectivity.""" diff --git a/app/resources/health.py b/app/resources/health.py index 157034d..39f7062 100644 --- a/app/resources/health.py +++ b/app/resources/health.py @@ -9,16 +9,16 @@ router = APIRouter() @router.get("/health-check") async def health_check() -> dict[str, str]: """Comprehensive health check endpoint.""" - + # Check database connectivity db_healthy = DatabaseService.health_check() - + status = "healthy" if db_healthy else "unhealthy" - + result = { "status": status, "service": "loapi", "database": "connected" if db_healthy else "disconnected" } - + return result