26 lines
729 B
Python
26 lines
729 B
Python
from datetime import datetime, time
|
|
import os
|
|
from fastapi import FastAPI
|
|
from contextlib import asynccontextmanager
|
|
from app.api.routes import router
|
|
from app.core.database import db_connector
|
|
from app.core.logging import migration_logger
|
|
from app.services.replication_state import replication_state
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
yield
|
|
await db_connector.dispose_engines()
|
|
|
|
|
|
app = FastAPI(title="Сервис репликации", lifespan=lifespan)
|
|
app.include_router(router)
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
return {
|
|
"service": "Сервис репликации",
|
|
"status": "онлайн",
|
|
"last_replication": replication_state.get_last_replication_info()
|
|
} |