overflow_gateway_webapp/main.go
crusader e92a8ead89 ing
2017-11-14 19:10:28 +09:00

48 lines
769 B
Go

package main
import (
"fmt"
"log"
"os"
"os/signal"
"syscall"
"git.loafle.net/commons_go/logging"
"git.loafle.net/overflow/overflow_gateway_webapp/server"
"git.loafle.net/overflow/overflow_gateway_webapp/servlet/web"
oogws "git.loafle.net/overflow/overflow_gateway_websocket/server"
)
func main() {
defer logging.Logger().Sync()
s := initializeServer()
stop := make(chan os.Signal)
signal.Notify(stop, syscall.SIGINT)
go func() {
if err := s.Start(); nil != err {
log.Printf("Server: Start error %v", err)
return
}
}()
select {
case signal := <-stop:
fmt.Printf("Got signal: %v\n", signal)
}
s.Stop()
}
func initializeServer() oogws.Server {
sh := server.NewServerHandler()
web.Initialize(sh)
s := oogws.New(sh)
return s
}