feat: switch away from websocket to stdout messaging for agent

This commit is contained in:
Aarnav Tale
2025-04-11 12:00:19 -04:00
parent 608fcacdb1
commit c5e6a6c407
19 changed files with 522 additions and 420 deletions
+10 -6
View File
@@ -8,6 +8,11 @@ import (
"github.com/tale/headplane/agent/internal/util"
)
type Register struct {
Type string
ID string
}
func main() {
log := util.GetLogger()
cfg, err := config.Load()
@@ -21,11 +26,10 @@ func main() {
agent.Connect()
defer agent.Shutdown()
ws, err := hpagent.NewSocket(agent, cfg)
if err != nil {
log.Fatal("Failed to create websocket: %s", err)
}
log.Msg(&Register{
Type: "register",
ID: agent.ID,
})
defer ws.StopListening()
ws.FollowMaster()
hpagent.FollowMaster(agent)
}