From 876b3333971c2a5cf701f1076157679ea2f4f1df Mon Sep 17 00:00:00 2001 From: Piotr Dec Date: Thu, 16 Oct 2025 21:33:25 +0200 Subject: [PATCH] fix: ASGI run & ports fix --- .gitignore | 1 + app/config/settings.py | 2 +- app/main.py | 15 ++++++++++----- config/config.yaml | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index b85bc8b..8395e24 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.iml uv.lock **/*.kdbx* +.compose_repository __pycache__/ **/dist/ diff --git a/app/config/settings.py b/app/config/settings.py index 06f75e3..7e072aa 100644 --- a/app/config/settings.py +++ b/app/config/settings.py @@ -8,7 +8,7 @@ from pydantic_settings import BaseSettings, SettingsConfigDict class AppConfig(BaseModel): host: str = "127.0.0.1" - port: int = 8000 + port: int = 8081 reload: bool = True diff --git a/app/main.py b/app/main.py index 22e83b4..5bf8c98 100644 --- a/app/main.py +++ b/app/main.py @@ -1,7 +1,7 @@ import logging -from injectable import load_injection_container from fastapi import FastAPI +from injectable import load_injection_container from app.config import get_settings from app.core.core import WebhookProcessor @@ -9,13 +9,18 @@ from app.util.logging import LoggingHandler, ExternalLoggingHandler class KarlApplication: + from starlette.types import Receive, Scope, Send def __init__(self) -> None: self._set_logging() - app = FastAPI(title="Karl", version="0.1.0") - self._set_routes(app) - self._set_events(app) + _app = FastAPI(title="Karl", version="0.1.0") + self._set_routes(_app) + self._set_events(_app) self._init_services() - pass + + self._app = _app + + async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: + await self._app.__call__(scope, receive, send) def _set_logging(self): logging.basicConfig(level=logging.INFO, handlers=[LoggingHandler()]) diff --git a/config/config.yaml b/config/config.yaml index 6d4400f..856d24e 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -1,6 +1,6 @@ app: host: "127.0.0.1" - port: 8000 + port: 8081 reload: true git: path: "F:/IdeaProjects/paas/karl/.compose_repository"