Use lazy initialization for the default grpc client

This avoids using a public global variable. It allows us to initialize
the default client a bit later (outside of init()). That way we can e.g.
properly initialize the in-memory registry.
This commit is contained in:
Ralf Haferkamp
2022-09-26 16:25:56 +02:00
committed by Ralf Haferkamp
parent 0ae75f8e66
commit 01650a5023
7 changed files with 28 additions and 18 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ func Index(cfg *config.Config) *cli.Command {
return parser.ParseConfig(cfg)
},
Action: func(c *cli.Context) error {
client := searchsvc.NewSearchProviderService("com.owncloud.api.search", grpc.DefaultClient)
client := searchsvc.NewSearchProviderService("com.owncloud.api.search", grpc.DefaultClient())
_, err := client.IndexSpace(context.Background(), &searchsvc.IndexSpaceRequest{
SpaceId: c.String("space"),
UserId: c.String("user"),