overflow_discovery/main.go
crusader 3ceb82880a ing
2018-03-21 19:34:40 +09:00

64 lines
904 B
Go

package main
import (
"flag"
"os"
"os/signal"
"syscall"
"git.loafle.net/commons_go/logging"
oocc "git.loafle.net/overflow/overflow_commons_go/config"
"git.loafle.net/overflow/overflow_discovery/server"
)
var (
pidPath *string
logConfigPath *string
)
func init() {
pidPath = oocc.FlagPidFilePath("./dist/discovery.pid")
logConfigPath = oocc.FlagLogConfigFilePath("")
flag.Parse()
logging.InitializeLogger(*logConfigPath)
}
func main() {
defer logging.Logger().Sync()
s := server.New(*pidPath)
stop := make(chan os.Signal)
signal.Notify(stop, syscall.SIGINT)
go func() {
if err := s.Start(); nil != err {
logging.Logger().Infof("Server: Start error %v", err)
return
}
}()
select {
case signal := <-stop:
logging.Logger().Infof("Got signal: %v\n", signal)
}
s.Stop()
}
/**
azure
consul
dns
ec2
file
gce
kubernetes
marathon
openstack
triton
zookeeper
*/