Add main server implementation and initial configuration handling
This commit is contained in:
@@ -8,7 +8,6 @@ config/config.yaml
|
|||||||
|
|
||||||
dist/
|
dist/
|
||||||
__debug_bin*
|
__debug_bin*
|
||||||
server
|
|
||||||
node_modules/
|
node_modules/
|
||||||
.next/
|
.next/
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user