1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2025-01-07 04:49:17 +00:00
ctrl/cmd/main.go

42 lines
1.2 KiB
Go

package main
import (
"flag"
"log"
"net/http"
"os"
_ "net/http/pprof"
"github.com/RaaLabs/steward"
)
func main() {
nodeName := flag.String("node", "0", "some unique string to identify this Edge unit")
brokerAddress := flag.String("brokerAddress", "0", "the address of the message broker")
profilingPort := flag.String("profilingPort", "", "The number of the profiling port")
promHostAndPort := flag.String("promHostAndPort", ":2112", "host and port for prometheus listener, e.g. localhost:2112")
centralErrorLogger := flag.Bool("centralErrorLogger", false, "seet to true if this is the node that should receive the error log's from other nodes")
//isCentral := flag.Bool("isCentral", false, "used to indicate that this is the central master that will subscribe to error message subjects")
flag.Parse()
if *profilingPort != "" {
// TODO REMOVE: Added for profiling
go func() {
http.ListenAndServe("localhost:"+*profilingPort, nil)
}()
}
s, err := steward.NewServer(*brokerAddress, *nodeName, *promHostAndPort, *centralErrorLogger)
if err != nil {
log.Printf("error: failed to connect to broker: %v\n", err)
os.Exit(1)
}
// Start the messaging server
go s.Start()
select {}
}