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