"""游民社区独立进程入口 — 仅挂 social_svc,不拖垮 ebook/community/pay。""" from __future__ import annotations import sys from pathlib import Path from fastapi import FastAPI ROOT = Path(__file__).resolve().parent SERVICES = ROOT / "services" sys.path.insert(0, str(ROOT)) sys.path.insert(0, str(SERVICES)) from social_svc.config import SOCIAL_ENABLED # noqa: E402 from social_svc.realtime import issue_connection_token # noqa: E402 from social_svc.routers import router as social_router # noqa: E402 from social_svc.store import init_db # noqa: E402 app = FastAPI(title="nomadro-social", docs_url=None, redoc_url=None) @app.on_event("startup") def _startup() -> None: if SOCIAL_ENABLED: init_db() if SOCIAL_ENABLED: app.include_router(social_router, prefix="/api/social/v1") @app.get("/health") def health(): from social_svc.config import CENTRIFUGO_ENABLED return { "ok": True, "service": "nomadro-social", "social": bool(SOCIAL_ENABLED), "centrifugo": bool(CENTRIFUGO_ENABLED), }