You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
754 B
Go

3 years ago
package main
import (
"dcg/config"
"dcg/game/msg_transfer"
"dcg/game/svc"
"dcg/pkg/logger"
"flag"
"git.noahlan.cn/northlan/ngs"
"git.noahlan.cn/northlan/ngs/serialize/protobuf"
3 years ago
)
var configFile = flag.String("f", "./config.yml", "the config file")
3 years ago
func main() {
flag.Parse()
config.Init(*configFile)
_ = logger.InitLogger(&config.Config.Log.File, &config.Config.Log.Console)
defer logger.Sync()
3 years ago
ctx := svc.NewServiceContext()
3 years ago
msg_transfer.Init(ctx)
msg_transfer.Run()
3 years ago
opts := make([]ngs.Option, 0)
opts = append(opts, ngs.WithComponents(ctx.Services))
opts = append(opts, ngs.WithSerializer(protobuf.NewSerializer()))
if config.Config.Server.Debug {
ngs.WithDebugMode()
3 years ago
}
ngs.Listen(config.Config.Server.Listen, opts...)
3 years ago
}