chore: bootstrap repository with governance docs
Initialize git, add Apache-2.0 LICENSE, .gitattributes (LF line endings), AGENTS.md (entry points, stack, discovery order, baseline checks), RUNBOOK.md (dev boot, prod deploy with overlay, ingestion, failures, rollback, scaling notes), .env.prod.example with rotated credential placeholders, and dev-only warnings on .env.example. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
52
app/main.py
Normal file
52
app/main.py
Normal file
@@ -0,0 +1,52 @@
|
||||
"""FastAPI entrypoint."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from contextlib import asynccontextmanager
|
||||
from typing import AsyncIterator
|
||||
|
||||
from fastapi import FastAPI
|
||||
|
||||
from app import __version__
|
||||
from app.api import routes_health, routes_ingestion, routes_search
|
||||
from app.config import settings
|
||||
from app.logging_config import configure_logging, get_logger
|
||||
|
||||
configure_logging()
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI) -> AsyncIterator[None]:
|
||||
logger.info("api.startup", version=__version__, prefix=settings.app_api_prefix)
|
||||
# Best-effort bootstrap of MinIO buckets - non-fatal if it fails (health will reflect).
|
||||
try:
|
||||
from app.storage.minio_client import get_storage
|
||||
|
||||
get_storage().ensure_buckets()
|
||||
except Exception as exc: # noqa: BLE001
|
||||
logger.warning("api.startup.minio_bootstrap_failed", error=str(exc))
|
||||
yield
|
||||
logger.info("api.shutdown")
|
||||
|
||||
|
||||
app = FastAPI(
|
||||
title="LegacyHUB",
|
||||
description="Hybrid lexical + semantic search over legacy PDF archives",
|
||||
version=__version__,
|
||||
lifespan=lifespan,
|
||||
)
|
||||
|
||||
app.include_router(routes_health.router, prefix=settings.app_api_prefix)
|
||||
app.include_router(routes_ingestion.router, prefix=settings.app_api_prefix)
|
||||
app.include_router(routes_search.router, prefix=settings.app_api_prefix)
|
||||
|
||||
|
||||
@app.get("/")
|
||||
def root() -> dict[str, str]:
|
||||
return {
|
||||
"service": "LegacyHUB",
|
||||
"version": __version__,
|
||||
"api": settings.app_api_prefix,
|
||||
"docs": "/docs",
|
||||
}
|
||||
Reference in New Issue
Block a user