3 Star 0 Fork 0

广东宇凌网络科技有限公司 / simple-iot-basic-rpc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
basic.go 1003 Bytes
一键复制 编辑 原始数据 按行查看 历史
HienGee 提交于 2024-04-26 11:19 . init
package main
import (
"flag"
"fmt"
"gitee.com/yuLingNet/simple-iot-basic-rpc/internal/config"
"gitee.com/yuLingNet/simple-iot-basic-rpc/internal/server"
"gitee.com/yuLingNet/simple-iot-basic-rpc/internal/svc"
"gitee.com/yuLingNet/simple-iot-basic-rpc/types/basic"
"github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/core/service"
"github.com/zeromicro/go-zero/zrpc"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
)
var configFile = flag.String("f", "etc/basic.yaml", "the config file")
func main() {
flag.Parse()
var c config.Config
conf.MustLoad(*configFile, &c, conf.UseEnv())
ctx := svc.NewServiceContext(c)
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
basic.RegisterBasicServer(grpcServer, server.NewBasicServer(ctx))
if c.Mode == service.DevMode || c.Mode == service.TestMode {
reflection.Register(grpcServer)
}
})
defer s.Stop()
fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
s.Start()
}
Go
1
https://gitee.com/yuLingNet/simple-iot-basic-rpc.git
git@gitee.com:yuLingNet/simple-iot-basic-rpc.git
yuLingNet
simple-iot-basic-rpc
simple-iot-basic-rpc
0ce7f3c9409c

搜索帮助