Separate out grpc client to package local for ocs service.

This commit is contained in:
Daniel Swärd
2023-07-28 11:53:22 +02:00
parent 44d9c50f1e
commit aa44ec12ac
3 changed files with 4 additions and 3 deletions

View File

@@ -35,7 +35,7 @@ func Server(cfg *config.Config) *cli.Command {
return err
}
err = ogrpc.Configure(ogrpc.GetClientOptions(cfg.GRPCClientTLS)...)
cfg.GrpcClient, err = ogrpc.NewClient(ogrpc.GetClientOptions(cfg.GRPCClientTLS)...)
if err != nil {
return err
}

View File

@@ -4,6 +4,7 @@ import (
"context"
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
"go-micro.dev/v4/client"
)
// Config combines all available configuration parts.
@@ -19,6 +20,7 @@ type Config struct {
HTTP HTTP `yaml:"http"`
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
GrpcClient client.Client `yaml:"-"`
TokenManager *TokenManager `yaml:"token_manager"`

View File

@@ -9,7 +9,6 @@ import (
storesvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/store/v0"
revactx "github.com/cs3org/reva/v2/pkg/ctx"
"github.com/owncloud/ocis/v2/ocis-pkg/service/grpc"
"github.com/owncloud/ocis/v2/services/ocs/pkg/service/v0/data"
"github.com/owncloud/ocis/v2/services/ocs/pkg/service/v0/response"
merrors "go-micro.dev/v4/errors"
@@ -29,7 +28,7 @@ func (o Ocs) GetSigningKey(w http.ResponseWriter, r *http.Request) {
// use the user's UUID
userID := u.Id.OpaqueId
c := storesvc.NewStoreService("com.owncloud.api.store", grpc.DefaultClient())
c := storesvc.NewStoreService("com.owncloud.api.store", o.config.GrpcClient)
res, err := c.Read(r.Context(), &storesvc.ReadRequest{
Options: &storemsg.ReadOptions{
Database: "proxy",