#!/usr/bin/env python3
"""
SalesPipeline 應用程式啟動腳本
用於開發與生產環境
"""
import sys
import os

# 確保可以匯入 app 模組
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

import uvicorn
from app.config import APP_HOST, APP_PORT, WORKERS, DEBUG

def main():
    """啟動應用程式"""
    print(f"Starting SalesPipeline on {APP_HOST}:{APP_PORT}")
    print(f"Workers: {WORKERS}, Debug: {DEBUG}")

    uvicorn.run(
        "app.main:app",
        host=APP_HOST,
        port=APP_PORT,
        workers=WORKERS if not DEBUG else 1,
        reload=DEBUG,
        access_log=True,
    )

if __name__ == "__main__":
    main()
