Separate out grpc client to package local for ocs service.
This commit is contained in:
@@ -35,7 +35,7 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ogrpc.Configure(ogrpc.GetClientOptions(cfg.GRPCClientTLS)...)
|
cfg.GrpcClient, err = ogrpc.NewClient(ogrpc.GetClientOptions(cfg.GRPCClientTLS)...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
|
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
|
||||||
|
"go-micro.dev/v4/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config combines all available configuration parts.
|
// Config combines all available configuration parts.
|
||||||
@@ -19,6 +20,7 @@ type Config struct {
|
|||||||
HTTP HTTP `yaml:"http"`
|
HTTP HTTP `yaml:"http"`
|
||||||
|
|
||||||
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
|
GRPCClientTLS *shared.GRPCClientTLS `yaml:"grpc_client_tls"`
|
||||||
|
GrpcClient client.Client `yaml:"-"`
|
||||||
|
|
||||||
TokenManager *TokenManager `yaml:"token_manager"`
|
TokenManager *TokenManager `yaml:"token_manager"`
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import (
|
|||||||
storesvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/store/v0"
|
storesvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/store/v0"
|
||||||
|
|
||||||
revactx "github.com/cs3org/reva/v2/pkg/ctx"
|
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/data"
|
||||||
"github.com/owncloud/ocis/v2/services/ocs/pkg/service/v0/response"
|
"github.com/owncloud/ocis/v2/services/ocs/pkg/service/v0/response"
|
||||||
merrors "go-micro.dev/v4/errors"
|
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
|
// use the user's UUID
|
||||||
userID := u.Id.OpaqueId
|
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{
|
res, err := c.Read(r.Context(), &storesvc.ReadRequest{
|
||||||
Options: &storemsg.ReadOptions{
|
Options: &storemsg.ReadOptions{
|
||||||
Database: "proxy",
|
Database: "proxy",
|
||||||
|
|||||||
Reference in New Issue
Block a user