支持动态端口

This commit is contained in:
suguo.yao 2021-09-15 19:04:51 +08:00
parent abf81b2cc9
commit 0603d042c5
1 changed files with 11 additions and 3 deletions

View File

@ -20,13 +20,21 @@ type Config struct {
}
var rpc *grpc.Server
var conf Config
var conf *Config
func Init(config *Config) *grpc.Server {
if config == nil {
config = &Config{
Address: "",
Port: 0,
AppName: "dev",
}
}
conf = config
func Init(config Config) *grpc.Server {
if rpc == nil {
rpc = grpc.NewServer(grpc.MaxRecvMsgSize(1024*1024), grpc.MaxSendMsgSize(1024*1024))
}
conf = config
return rpc
}