44 lines
1.0 KiB
Go
44 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"ai_scheduler/internal/config"
|
|
|
|
"flag"
|
|
"fmt"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/gofiber/fiber/v2/log"
|
|
)
|
|
|
|
// Swagger 文档注解(保持不变)
|
|
// @title AI Scheduler API
|
|
// @version 1.0
|
|
// @description 智能路由调度系统API文档
|
|
// @termsOfService http://swagger.io/terms/
|
|
// @contact.name API Support
|
|
// @contact.url http://www.swagger.io/support
|
|
// @contact.email support@swagger.io
|
|
// @license.name Apache 2.0
|
|
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
|
|
// @host localhost:8080
|
|
// @BasePath /
|
|
|
|
func main() {
|
|
|
|
configPath := flag.String("config", "config.yaml", "Path to configuration file")
|
|
flag.Parse()
|
|
bc, err := config.LoadConfig(*configPath)
|
|
if err != nil {
|
|
log.Fatalf("加载配置失败: %v", err)
|
|
}
|
|
app, cleanup, err := InitializeApp(bc, log.DefaultLogger())
|
|
if err != nil {
|
|
log.Fatalf("项目初始化失败: %v", err)
|
|
}
|
|
defer cleanup()
|
|
|
|
gin.SetMode(gin.ReleaseMode)
|
|
|
|
log.Fatal(app.HttpServer.Listen(fmt.Sprintf(":%d", bc.Server.Port)))
|
|
}
|