26 lines
566 B
Go
26 lines
566 B
Go
// sm-leaf: in-process NATS core plus optional leaf to the Verae hub.
|
|
package main
|
|
|
|
import (
|
|
"flag"
|
|
"log"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
"github.com/marchon/secure-messaging/internal/leaf"
|
|
)
|
|
|
|
func main() {
|
|
hub := flag.String("hub", os.Getenv("SM_LEAF_HUB"), "leaf hub URL, e.g. nats-leaf://10.10.10.21:7422")
|
|
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)
|
|
ch := make(chan os.Signal, 1)
|
|
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
|
|
<-ch
|
|
_ = n.Shutdown()
|
|
}
|