From c3afa961c0e234391004eec26064bc654f43b46c Mon Sep 17 00:00:00 2001 From: Jimil Desai Date: Wed, 7 Jul 2021 17:11:44 +0530 Subject: [PATCH] fix: populate pluginregistry at init time Signed-off-by: Jimil Desai --- internal/grpc/services/userprovider/userprovider.go | 3 --- pkg/user/rpc_user.go | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/grpc/services/userprovider/userprovider.go b/internal/grpc/services/userprovider/userprovider.go index 3c74cf2dac4..fc9fe76810d 100644 --- a/internal/grpc/services/userprovider/userprovider.go +++ b/internal/grpc/services/userprovider/userprovider.go @@ -27,7 +27,6 @@ import ( userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" "github.com/cs3org/reva/pkg/errtypes" "github.com/cs3org/reva/pkg/plugin" - "github.com/cs3org/reva/pkg/pluginregistry" "github.com/cs3org/reva/pkg/rgrpc" "github.com/cs3org/reva/pkg/rgrpc/status" "github.com/cs3org/reva/pkg/sharedconf" @@ -95,8 +94,6 @@ func getDriverPlugin(c *config) (user.Manager, error) { func getDriver(c *config, plugin bool) (user.Manager, error) { // if plugin flag is set, we fetch the driver from the plugin package via hashicorp go-plugin system if plugin { - // populate the plugin registry - pluginregistry.Register("userprovider", &user.ProviderPlugin{}) mgr, err := getDriverPlugin(c) if err != nil { return nil, err diff --git a/pkg/user/rpc_user.go b/pkg/user/rpc_user.go index 54ee81e5c40..8c2612b29f0 100644 --- a/pkg/user/rpc_user.go +++ b/pkg/user/rpc_user.go @@ -23,9 +23,14 @@ import ( "net/rpc" userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" + "github.com/cs3org/reva/pkg/pluginregistry" "github.com/hashicorp/go-plugin" ) +func init() { + pluginregistry.Register("userprovider", &ProviderPlugin{}) +} + // ProviderPlugin is the implemenation of plugin.Plugin so we can serve/consume this. type ProviderPlugin struct { Impl Manager