S15: sm-leaf health HTTP, verae.sm.* acks, systemd unit
Some checks are pending
ci / python (push) Waiting to run
ci / go (push) Waiting to run

Loopback GET /health, nats-leaf:// rewrite, subject request-reply tests.
Do not replace pfc-py-admin. NpeRequired stays on the package surface.
This commit is contained in:
George Lambert 2026-09-15 22:40:50 -04:00
parent 9eed0b1942
commit f4da7ff446
7 changed files with 158 additions and 11 deletions

View file

@ -12,15 +12,28 @@ import (
)
func main() {
hub := flag.String("hub", os.Getenv("SM_LEAF_HUB"), "leaf hub URL, e.g. nats-leaf://10.10.10.21:7422")
hub := flag.String("hub", os.Getenv("SM_LEAF_HUB"), "leaf hub URL, e.g. nats://10.10.10.21:7422")
httpAddr := flag.String("http", getenv("SM_HTTP", "127.0.0.1:18783"), "loopback health HTTP")
flag.Parse()
n, err := leaf.Start(*hub)
if err != nil {
log.Fatal(err)
}
log.Printf("sm-leaf in-process nats %s hub=%q", n.Addr(), *hub)
log.Printf("sm-leaf in-process nats %s hub=%q http=%s", n.Addr(), *hub, *httpAddr)
go func() {
if err := leaf.ServeHealth(*httpAddr); err != nil {
log.Printf("health: %v", err)
}
}()
ch := make(chan os.Signal, 1)
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
<-ch
_ = n.Shutdown()
}
func getenv(k, d string) string {
if v := os.Getenv(k); v != "" {
return v
}
return d
}