Files
vantage-agent/cmd/main.go
T
mrhid6 6b2c5f6f62
Agent Release / build (push) Successful in 2m23s
Agent Release / msi (push) Successful in 3m10s
refactor: stand up vantage-agent as its own repository
agent/ becomes the repository root, so the module is
gitea.hostxtra.co.uk/vantage/vantage-agent, and installer/ comes with it.

Releases move to this repository, and internal/sync's self-update URLs
move with them. Agents built before this point have the old
mrhid6/vantage path compiled in and will fail the push-button update;
re-running the server-generated /update one-liner on each host moves
them onto a build that knows the new address.
2026-09-08 08:58:30 +00:00

40 lines
910 B
Go

package main
import (
"context"
"flag"
"log"
"os/signal"
"syscall"
"gitea.hostxtra.co.uk/vantage/vantage-agent/internal/config"
agentsync "gitea.hostxtra.co.uk/vantage/vantage-agent/internal/sync"
)
var Version = "dev"
func main() {
genKey := flag.String("generate-key", "", "Generate SSH keypair and upload with this label")
flag.Parse()
cfg, err := config.Load()
if err != nil {
log.Fatalf("failed to load config: %v", err)
}
if *genKey != "" {
if err := agentsync.GenerateAndUpload(cfg, *genKey); err != nil {
log.Fatalf("key generation failed: %v", err)
}
return
}
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer stop()
log.Printf("vantage-agent %s starting (server=%s, poll=%s)", Version, cfg.ServerURL, cfg.PollInterval)
if err := agentsync.Run(ctx, cfg, Version); err != nil {
log.Fatalf("agent error: %v", err)
}
}