-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
41 lines (35 loc) · 1 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"net"
"github.com/cloudwego/kitex/pkg/klog"
"github.com/cloudwego/kitex/pkg/rpcinfo"
"github.com/cloudwego/kitex/server"
"github.com/kitex-contrib/obs-opentelemetry/tracing"
"github.com/xh-polaris/gopkg/kitex/middleware"
logx "github.com/xh-polaris/gopkg/util/log"
"github.com/xh-polaris/service-idl-gen-go/kitex_gen/meowchat/user/userservice"
"github.com/xh-polaris/meowchat-user/biz/infrastructure/util/log"
"github.com/xh-polaris/meowchat-user/provider"
)
func main() {
klog.SetLogger(logx.NewKlogLogger())
s, err := provider.NewUserServerImpl()
if err != nil {
panic(err)
}
addr, err := net.ResolveTCPAddr("tcp", s.ListenOn)
if err != nil {
panic(err)
}
svr := userservice.NewServer(
s,
server.WithServiceAddr(addr),
server.WithSuite(tracing.NewServerSuite()),
server.WithServerBasicInfo(&rpcinfo.EndpointBasicInfo{ServiceName: s.Name}),
server.WithMiddleware(middleware.LogMiddleware(s.Name)),
)
err = svr.Run()
if err != nil {
log.Error(err.Error())
}
}