27 lines
572 B
Go
27 lines
572 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
|
|
"bsm/full/module/social/group/internal/server"
|
|
gwRuntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
type ExposeOptions struct {
|
|
Dependencies
|
|
GRPC *grpc.Server
|
|
Gateway *gwRuntime.ServeMux
|
|
}
|
|
|
|
// Expose 供聚合宿主接入:注册 gRPC service 与网关路由
|
|
func Expose(options ExposeOptions) error {
|
|
applyDependencies(options.Dependencies)
|
|
server.New(options.GRPC)
|
|
|
|
if options.Gateway == nil {
|
|
return nil
|
|
}
|
|
return server.RegisterGateway(context.Background(), options.Gateway)
|
|
}
|