overflow_gateway_webapp/main.go

48 lines
769 B
Go
Raw Normal View History

2017-11-13 16:50:37 +00:00
package main
2017-11-14 03:45:48 +00:00
import (
"fmt"
"log"
"os"
"os/signal"
"syscall"
"git.loafle.net/commons_go/logging"
"git.loafle.net/overflow/overflow_gateway_webapp/server"
2017-11-14 10:10:28 +00:00
"git.loafle.net/overflow/overflow_gateway_webapp/servlet/web"
2017-11-14 03:45:48 +00:00
oogws "git.loafle.net/overflow/overflow_gateway_websocket/server"
)
2017-11-13 16:50:37 +00:00
func main() {
2017-11-14 03:45:48 +00:00
defer logging.Logger().Sync()
2017-11-14 10:10:28 +00:00
s := initializeServer()
2017-11-14 03:45:48 +00:00
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()
2017-11-13 16:50:37 +00:00
}
2017-11-14 10:10:28 +00:00
func initializeServer() oogws.Server {
sh := server.NewServerHandler()
web.Initialize(sh)
s := oogws.New(sh)
return s
}