diff --git a/.gitignore b/.gitignore index 3e3424b..9c0b953 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,6 @@ config/config.yaml dist/ __debug_bin* -server node_modules/ .next/ *.tsbuildinfo diff --git a/cmd/server/main.go b/cmd/server/main.go new file mode 100644 index 0000000..8a5f1d3 --- /dev/null +++ b/cmd/server/main.go @@ -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 + } +}