mirror of
https://github.com/tale/headplane.git
synced 2026-08-05 19:57:42 +00:00
8cb91cd45b
* Added backoff and liveness probes for better management * Switched IPC to a simple text based system * Lookups don't directly touch the agent now * Use the database as a source of truth
39 lines
650 B
Go
39 lines
650 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
_ "github.com/joho/godotenv/autoload"
|
|
"github.com/tale/headplane/internal/config"
|
|
"github.com/tale/headplane/internal/hpagent"
|
|
"github.com/tale/headplane/internal/tsnet"
|
|
"github.com/tale/headplane/internal/util"
|
|
)
|
|
|
|
type Register struct {
|
|
Type string
|
|
ID string
|
|
}
|
|
|
|
func main() {
|
|
log := util.GetLogger()
|
|
cfg, err := config.Load()
|
|
if err != nil {
|
|
log.Fatal("Failed to load config: %s", err)
|
|
}
|
|
|
|
log.SetDebug(cfg.Debug)
|
|
agent := tsnet.NewAgent(cfg)
|
|
|
|
agent.Connect()
|
|
defer agent.Shutdown()
|
|
|
|
log.Msg(&Register{
|
|
Type: "register",
|
|
ID: agent.ID,
|
|
})
|
|
|
|
fmt.Println("READY")
|
|
hpagent.FollowMaster(agent)
|
|
}
|