-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
38 lines (34 loc) · 985 Bytes
/
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
package main
import (
"net"
"github.com/CloudStriver/cloudmind-system/provider"
"github.com/CloudStriver/go-pkg/utils/kitex/middleware"
"github.com/CloudStriver/go-pkg/utils/util/log"
"github.com/CloudStriver/service-idl-gen-go/kitex_gen/cloudmind/system/systemservice"
"github.com/cloudwego/kitex/pkg/klog"
"github.com/cloudwego/kitex/pkg/rpcinfo"
"github.com/cloudwego/kitex/server"
"github.com/kitex-contrib/obs-opentelemetry/tracing"
)
func main() {
klog.SetLogger(log.NewKlogLogger())
s, err := provider.NewSystemServerImpl()
if err != nil {
panic(err)
}
addr, err := net.ResolveTCPAddr("tcp", s.ListenOn)
if err != nil {
panic(err)
}
svr := systemservice.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())
}
}