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