Add main server implementation and initial configuration handling

This commit is contained in:
yoc
2026-04-09 19:59:54 +08:00
parent 399c29002b
commit 7411bac57d
2 changed files with 32 additions and 1 deletions
-1
View File
@@ -8,7 +8,6 @@ config/config.yaml
dist/
__debug_bin*
server
node_modules/
.next/
*.tsbuildinfo
+32
View File
@@ -0,0 +1,32 @@
package main
import (
"flag"
"log/slog"
"cs-agent/internal/bootstrap"
"cs-agent/internal/pkg/config"
)
func main() {
configPath := flag.String("config", "config/config.yaml", "path to config file")
flag.Parse()
if err := bootstrap.Init(*configPath); err != nil {
slog.Error("bootstrap init failed", "error", err)
return
}
cfg := config.Current()
app, err := bootstrap.NewServer()
if err != nil {
slog.Error("bootstrap server failed", "error", err)
return
}
if err := app.Listen(cfg.Server.Address()); err != nil {
slog.Error("start server failed", "error", err)
return
}
}