overflow_discovery/main.go

62 lines
721 B
Go
Raw Normal View History

2017-10-26 12:55:55 +00:00
package main
import (
2017-10-27 06:01:09 +00:00
"flag"
"fmt"
2017-10-26 12:55:55 +00:00
"log"
2017-10-27 06:01:09 +00:00
"os"
"os/signal"
"syscall"
2017-10-26 12:55:55 +00:00
2017-11-15 06:59:43 +00:00
"git.loafle.net/commons_go/logging"
2017-10-26 12:55:55 +00:00
"git.loafle.net/overflow/overflow_discovery/server"
)
2017-10-27 06:01:09 +00:00
var (
sockFile *string
)
func init() {
sockFile = flag.String("sock", serverAddr, "Socket file")
flag.Parse()
}
2017-10-26 12:55:55 +00:00
func main() {
2017-11-15 06:59:43 +00:00
defer logging.Logger().Sync()
2017-10-26 12:55:55 +00:00
2017-11-15 06:59:43 +00:00
s := server.New(*sockFile)
2017-10-26 12:55:55 +00:00
2017-10-27 06:01:09 +00:00
stop := make(chan os.Signal)
signal.Notify(stop, syscall.SIGINT)
2017-10-26 12:55:55 +00:00
2017-10-27 06:01:09 +00:00
go func() {
2017-11-15 06:59:43 +00:00
if err := s.Start(); nil != err {
log.Printf("Server: Start error %v", err)
2017-10-27 06:01:09 +00:00
return
}
}()
2017-10-26 12:55:55 +00:00
2017-10-27 06:01:09 +00:00
select {
case signal := <-stop:
fmt.Printf("Got signal: %v\n", signal)
2017-10-26 12:55:55 +00:00
}
2017-11-15 06:59:43 +00:00
2017-10-27 06:01:09 +00:00
s.Stop()
2017-10-26 12:55:55 +00:00
}
/**
azure
consul
dns
ec2
file
gce
kubernetes
marathon
openstack
triton
zookeeper
*/