diff --git a/cmd/document.go b/cmd/document.go deleted file mode 100644 index 6f99b1b..0000000 --- a/cmd/document.go +++ /dev/null @@ -1,55 +0,0 @@ -package cmd - -import ( - "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/auth" - "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging" - "github.com/spf13/cobra" - "google.golang.org/grpc" - "google.golang.org/grpc/reflection" - "leaf - "net" -) - -func init() { - RootCmd.AddCommand(documentServiceCommand) -} - -var documentServiceCommand = &cobra.Command{ - Use: "document", - Short: "Start document service", - Run: func(cmd *cobra.Command, args []string) { - app, err := CreateApp() - if err != nil { - panic(err) - return - } - - app.Logger.Sugar.Info("Start document service") - - lis, err := net.Listen("tcp", app.Config.Grpc.Address) - if err != nil { - app.Logger.Sugar.Fatal(err) - } - var opts = []grpc.ServerOption{ - grpc.ChainUnaryInterceptor( - logging.UnaryServerInterceptor(app.Handler.GRPC.Interceptor.Logger.ZapLogInterceptor()), - - auth.UnaryServerInterceptor(app.Handler.GRPC.Interceptor.Auth.JwtAuth), - ), - grpc.ChainStreamInterceptor( - logging.StreamServerInterceptor(app.Handler.GRPC.Interceptor.Logger.ZapLogInterceptor()), - auth.StreamServerInterceptor(app.Handler.GRPC.Interceptor.Auth.JwtAuth), - ), - } - grpcServer := grpc.NewServer(opts...) - - documentService.RegisterDocumentServiceServer(grpcServer, app.Handler.GRPC.DocumentService) - reflection.Register(grpcServer) - - app.Logger.Sugar.Info("Document Service listing on " + app.Config.Grpc.Address) - - if err := grpcServer.Serve(lis); err != nil { - app.Logger.Sugar.Fatal(err) - } - }, -} diff --git a/internal/base/app.go b/internal/base/app.go index 3db6c44..f3e1a7d 100644 --- a/internal/base/app.go +++ b/internal/base/app.go @@ -2,7 +2,6 @@ package base import ( "gorm.io/gorm" - "leafdev.top/Leaf/api-platform/int "leafdev.top/Leaf/api-platform/internal/base/conf" "leafdev.top/Leaf/api-platform/internal/base/logger" "leafdev.top/Leaf/api-platform/internal/base/redis" @@ -12,7 +11,7 @@ import ( "leafdev.top/Leaf/api-platform/internal/dao" "leafdev.top/Leaf/api-platform/internal/handler" "leafdev.top/Leaf/api-platform/internal/handler/http" - "gorm.io/gorm" + "leafdev.top/Leaf/api-platform/internal/service" ) type Application struct {