feat: 添加 gRPC 反射和健康检查功能,优化服务器初始化逻辑

This commit is contained in:
Rogee
2025-09-11 16:04:32 +08:00
parent c0d8f070e4
commit 55a335e9ad
3 changed files with 554 additions and 11 deletions

View File

@@ -3,8 +3,6 @@ package grpc
import (
"go.ipao.vip/atom/container"
"go.ipao.vip/atom/opt"
"google.golang.org/grpc"
)
func Provide(opts ...opt.Option) error {
@@ -13,15 +11,8 @@ func Provide(opts ...opt.Option) error {
if err := o.UnmarshalConfig(&config); err != nil {
return err
}
return container.Container.Provide(func() (*Grpc, error) {
server := grpc.NewServer()
grpc := &Grpc{
Server: server,
config: &config,
}
container.AddCloseAble(grpc.Server.GracefulStop)
return grpc, nil
return &Grpc{config: &config}, nil
}, o.DiOptions()...)
}