-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
34 lines (28 loc) · 936 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
package main
import (
"github.com/hopeio/cherry/_example/user/api"
"github.com/hopeio/cherry/_example/user/confdao"
"github.com/hopeio/cherry/initialize"
"github.com/hopeio/cherry/initialize/conf_center/nacos"
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
"google.golang.org/grpc"
"github.com/hopeio/cherry/server"
)
func main() {
defer initialize.Start(confdao.Conf, confdao.Dao, nacos.ConfigCenter)()
config := confdao.Conf.Server.Origin()
config.GrpcOptions = []grpc.ServerOption{
grpc.StatsHandler(otelgrpc.NewServerHandler()),
}
server.Start(&server.Server{
Config: config,
//为了可以自定义中间件
GrpcHandler: api.GrpcRegister,
GinHandler: api.GinRegister,
/* GraphqlHandler: model.NewExecutableSchema(model.Config{
Resolvers: &model.GQLServer{
UserService: service.GetUserService(),
OauthService: service.GetOauthService(),
}}),*/
})
}