deprecated_overflow_gateway.../main.go
2017-09-19 17:28:21 +09:00

43 lines
988 B
Go

package main
import (
"context"
"flag"
"git.loafle.net/commons_go/config"
"git.loafle.net/commons_go/logging"
"git.loafle.net/overflow/overflow_gateway_web/conf"
"git.loafle.net/overflow/overflow_gateway_web/grpc"
"git.loafle.net/overflow/overflow_gateway_web/handler"
"git.loafle.net/overflow/overflow_gateway_web/redis"
"git.loafle.net/overflow/overflow_gateway_web/server"
"git.loafle.net/overflow/overflow_gateway_web/subscribe"
)
func main() {
configPath := flag.String("config", "./", "The path of config file")
flag.Parse()
config.SetConfigPath(*configPath)
if err := config.Load(&conf.Config, "config.json"); nil != err {
panic(err)
}
ctx := context.Background()
defer logging.Logger.Sync()
s := server.NewServer(ctx)
rp := redis.NewPool(ctx)
grpc.InitializePool(ctx)
wsh := handler.NewWebSocketHandler(ctx)
subscribe.Subscribe(ctx, rp.Get())
s.HandleSocket(conf.Config.Handlers["web"].Entry, wsh)
s.ListenAndServe(conf.Config.Server.Addr)
}