ЛР2: PostgreSQL + Valkey, сессии Basic/Bearer, миграции, compose, тесты, отчёт

This commit is contained in:
2026-10-15 19:17:22 +03:00
parent 65003b6119
commit 6808ed8c98
44 changed files with 2370 additions and 19 deletions
+38
View File
@@ -0,0 +1,38 @@
"""Container entrypoint: migrate, then run the HTTP server as PID 1."""
from __future__ import annotations
import logging
import os
import uvicorn
from .config import settings
from .migrate import apply_migrations
def main() -> None:
logging.basicConfig(
level=os.environ.get("LOG_LEVEL", "INFO").upper(),
format="%(asctime)s %(levelname)s %(name)s %(message)s",
)
logging.getLogger("messenger").info(
"starting messenger api env=%s host=%s port=%s sessions=%s cache=%s",
settings.app_env,
settings.app_host,
settings.app_port,
settings.session_store,
"on" if settings.cache_enabled else "off",
)
apply_migrations()
uvicorn.run(
"src.app:app",
host=settings.app_host,
port=settings.app_port,
log_level=os.environ.get("LOG_LEVEL", "info").lower(),
access_log=True,
timeout_graceful_shutdown=10,
)
if __name__ == "__main__":
main()