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() {
|
2021-03-01 19:49:43 +00:00
|
|
|
c := steward.NewConfiguration()
|
2021-03-24 09:14:17 +00:00
|
|
|
err := c.CheckFlags()
|
|
|
|
if err != nil {
|
|
|
|
log.Printf("%v\n", err)
|
|
|
|
return
|
|
|
|
}
|
2021-02-01 10:13:38 +00:00
|
|
|
|
2021-02-25 12:08:10 +00:00
|
|
|
// Start profiling if profiling port is specified
|
2021-03-01 19:49:43 +00:00
|
|
|
if c.ProfilingPort != "" {
|
2021-02-05 06:25:12 +00:00
|
|
|
go func() {
|
2021-03-01 19:49:43 +00:00
|
|
|
http.ListenAndServe("localhost:"+c.ProfilingPort, nil)
|
2021-02-05 06:25:12 +00:00
|
|
|
}()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-03-01 19:49:43 +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)
|
|
|
|
}
|
|
|
|
|
2021-02-10 04:11:48 +00:00
|
|
|
go s.Start()
|
2021-02-01 10:13:38 +00:00
|
|
|
|
|
|
|
select {}
|
|
|
|
}
|