overseer/cmd/bootstrap/main.go

34 lines
623 B
Go
Raw Permalink Normal View History

2016-02-08 01:06:54 +00:00
package main
import (
"strconv"
"time"
"github.com/jpillora/opts"
"github.com/jpillora/overseer"
"github.com/jpillora/overseer/fetcher"
2016-02-08 01:06:54 +00:00
)
func main() {
c := struct {
URL string `type:"arg" help:"<url> of where to GET the binary"`
Port int `help:"listening port"`
NoDebug bool `help:"disable debug mode"`
2016-02-08 01:06:54 +00:00
}{
Port: 3000,
}
opts.Parse(&c)
overseer.Run(overseer.Config{
Program: func(state overseer.State) {
//block forever
2016-02-08 01:06:54 +00:00
select {}
},
Address: ":" + strconv.Itoa(c.Port),
Fetcher: &fetcher.HTTP{
URL: c.URL,
Interval: 1 * time.Second,
},
Debug: !c.NoDebug,
2016-02-08 01:06:54 +00:00
})
}