package main

import (
	"fmt"
	"log"

	"sproutworkcollect-backend/internal/config"
	"sproutworkcollect-backend/internal/router"
)

func main() {
	cfg := config.Load()

	r := router.Setup(cfg)

	addr := fmt.Sprintf("0.0.0.0:%d", cfg.Port)
	log.Printf("[SproutWorkCollect] 服务启动 → http://%s", addr)
	log.Printf("[SproutWorkCollect] WorksDir  : %s", cfg.WorksDir)
	log.Printf("[SproutWorkCollect] ConfigDir : %s", cfg.ConfigDir)

	if err := r.Run(addr); err != nil {
		log.Fatalf("服务启动失败: %v", err)
	}
}
