123456789101112131415161718192021222324252627282930313233343536373839 |
- // Code generated by goctl. DO NOT EDIT!
- // Source: add.proto
- package main
- import (
- "bookstore/rpc/add/internal/config"
- "bookstore/rpc/add/internal/server"
- "bookstore/rpc/add/internal/svc"
- add "bookstore/rpc/add/pb"
- "flag"
- "fmt"
- "log"
- "github.com/tal-tech/go-zero/core/conf"
- "github.com/tal-tech/go-zero/rpcx"
- "google.golang.org/grpc"
- )
- var configFile = flag.String("f", "etc/add.yaml", "the config file")
- func main() {
- flag.Parse()
- var c config.Config
- conf.MustLoad(*configFile, &c)
- ctx := svc.NewServiceContext(c)
- adderSrv := server.NewAdderServer(ctx)
- s, err := rpcx.NewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
- add.RegisterAdderServer(grpcServer, adderSrv)
- })
- if err != nil {
- log.Fatal(err)
- }
- fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
- s.Start()
- }
|