1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2025-01-19 06:09:30 +00:00
ctrl/cmd/steward/main.go

37 lines
496 B
Go
Raw Normal View History

2021-02-01 11:13:38 +01:00
package main
import (
"log"
2021-02-05 07:25:12 +01:00
"net/http"
2021-02-01 11:13:38 +01:00
"os"
2021-02-05 07:25:12 +01:00
_ "net/http/pprof"
2021-02-01 11:13:38 +01: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 11:13:38 +01:00
// Start profiling if profiling port is specified
if c.ProfilingPort != "" {
2021-02-05 07:25:12 +01:00
go func() {
http.ListenAndServe("localhost:"+c.ProfilingPort, nil)
2021-02-05 07:25:12 +01:00
}()
}
s, err := steward.NewServer(c)
2021-02-01 11:13:38 +01:00
if err != nil {
2021-03-12 10:41:03 +01:00
log.Printf("%v\n", err)
2021-02-01 11:13:38 +01:00
os.Exit(1)
}
2021-08-03 13:07:26 +02:00
s.Start()
2021-02-01 11:13:38 +01:00
}