1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2024-12-14 12:37:31 +00:00
ctrl/cmd/steward/main.go

39 lines
511 B
Go
Raw Normal View History

2021-02-01 10:13:38 +00:00
package main
import (
"log"
2021-02-05 06:25:12 +00:00
"net/http"
2021-02-01 10:13:38 +00:00
"os"
2021-02-05 06:25:12 +00:00
_ "net/http/pprof"
2021-02-01 10:13:38 +00:00
"github.com/RaaLabs/steward"
)
func main() {
c := steward.NewConfiguration()
err := c.CheckFlags()
if err != nil {
log.Printf("%v\n", err)
return
}
2021-02-01 10:13:38 +00:00
// Start profiling if profiling port is specified
if c.ProfilingPort != "" {
2021-02-05 06:25:12 +00:00
go func() {
http.ListenAndServe("localhost:"+c.ProfilingPort, nil)
2021-02-05 06:25:12 +00:00
}()
}
s, err := steward.NewServer(c)
2021-02-01 10:13:38 +00:00
if err != nil {
2021-03-12 09:41:03 +00:00
log.Printf("%v\n", err)
2021-02-01 10:13:38 +00:00
os.Exit(1)
}
go s.Start()
2021-02-01 10:13:38 +00:00
select {}
}