""" Główny punkt wejścia serwisu plików Togethere File API. Uruchomienie: uvicorn main:app --host 127.0.0.1 --port 8001 Lub przez systemd (patrz systemd/togethere-file-api.service). """ from __future__ import annotations from fastapi import FastAPI from fastapi.middleware.trustedhost import TrustedHostMiddleware from .routers import admin_chat, admin_tasks, user_profile, user_files from .config import settings app = FastAPI( title="Togethere File API", version="1.0.0", # Wyłącz publiczną dokumentację – serwis dostępny tylko z localhost docs_url=None, redoc_url=None, openapi_url=None, ) # Akceptuj żądania tylko z localhost (dodatkowa warstwa ochrony) app.add_middleware( TrustedHostMiddleware, allowed_hosts=["127.0.0.1", "localhost"], ) app.include_router(admin_chat.router) app.include_router(admin_tasks.router) app.include_router(user_profile.router) app.include_router(user_files.router) @app.get("/health", include_in_schema=False) async def health_check(): """Endpoint do sprawdzenia działania serwisu.""" return {"status": "ok", "service": "togethere-file-api"} if __name__ == "__main__": import uvicorn uvicorn.run( "main:app", host=settings.host, port=settings.port, reload=False, )