From 0a06bdbdf8e49504f2ff567b63641a634c122172 Mon Sep 17 00:00:00 2001 From: renzhiyuan <465386466@qq.com> Date: Mon, 27 Jul 2026 10:11:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=96=87=E4=BB=B6:=20xy=5Fsh?= =?UTF-8?q?/cmd/server/main.go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xy_sh/cmd/server/main.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 xy_sh/cmd/server/main.go diff --git a/xy_sh/cmd/server/main.go b/xy_sh/cmd/server/main.go new file mode 100644 index 0000000..eae693b --- /dev/null +++ b/xy_sh/cmd/server/main.go @@ -0,0 +1,30 @@ +package main + +import ( + "log" + + "xy_sh/internal/config" + "xy_sh/internal/router" + "xy_sh/pkg/crypto" + + "github.com/gofiber/fiber/v2" +) + +func main() { + cfg := config.LoadConfig() + + crypto.InitCrypto(cfg.SM3Salt, cfg.SM4Key) + + app := fiber.New(fiber.Config{ + AppName: "XY SH API Server", + ReadTimeout: cfg.ReadTimeout, + WriteTimeout: cfg.WriteTimeout, + }) + + router.SetupRoutes(app) + + log.Printf("服务启动,监听端口: %s", cfg.ServerPort) + if err := app.Listen(":" + cfg.ServerPort); err != nil { + log.Fatalf("服务启动失败: %v", err) + } +} \ No newline at end of file