#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
服务启动脚本
"""

import uvicorn
import logging
from config import settings


def setup_logging():
    """设置日志"""
    logging.basicConfig(
        level=getattr(logging, settings.LOG_LEVEL),
        format=settings.LOG_FORMAT
    )


def main():
    """启动服务"""
    setup_logging()

    logger = logging.getLogger(__name__)
    logger.info("正在启动Isometquick Blender渲染服务...")
    logger.info(f"服务地址: http://{settings.HOST}:{settings.PORT}")
    logger.info(f"API文档: http://{settings.HOST}:{settings.PORT}/docs")

    uvicorn.run(
        "main:app",
        host=settings.HOST,
        port=settings.PORT,
        reload=settings.DEBUG,
        log_level=settings.LOG_LEVEL.lower()
    )


if __name__ == "__main__":
    main()
