from fastapi import FastAPI
from app.core.config import settings
from app.core.logger import logger

app = FastAPI(
    title="交换机 API 平台",
    description="自动化交换机配置和流量监控接口",
    version="1.0.0"
)

@logger.catch
def start():
    import uvicorn
    logger.info(f"启动服务： http://localhost:{settings.port}/docs")
    uvicorn.run("app.main:app", host="0.0.0.0", port=settings.port, reload=True)

if __name__ == "__main__":
    start()
