S06-S08: Python spec, Go in-process leaf, tests and Forgejo CI
This commit is contained in:
commit
d67509e470
16 changed files with 726 additions and 0 deletions
26
go/cmd/sm-leaf/main.go
Normal file
26
go/cmd/sm-leaf/main.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// 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()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue