register services after they are ready

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2024-11-07 10:38:23 +01:00
parent 75cba423c2
commit 1a429115c2
20 changed files with 43 additions and 26 deletions
@@ -9,6 +9,8 @@ import (
"github.com/cs3org/reva/v2/cmd/revad/runtime"
"github.com/gofrs/uuid"
"github.com/oklog/run"
"github.com/urfave/cli/v2"
"github.com/owncloud/ocis/v2/ocis-pkg/config/configlog"
"github.com/owncloud/ocis/v2/ocis-pkg/registry"
"github.com/owncloud/ocis/v2/ocis-pkg/tracing"
@@ -18,7 +20,6 @@ import (
"github.com/owncloud/ocis/v2/services/storage-system/pkg/logging"
"github.com/owncloud/ocis/v2/services/storage-system/pkg/revaconfig"
"github.com/owncloud/ocis/v2/services/storage-system/pkg/server/debug"
"github.com/urfave/cli/v2"
)
// Server is the entry point for the server command.
@@ -92,12 +93,12 @@ func Server(cfg *config.Config) *cli.Command {
})
grpcSvc := registry.BuildGRPCService(cfg.GRPC.Namespace+"."+cfg.Service.Name, cfg.GRPC.Protocol, cfg.GRPC.Addr, version.GetString())
if err := registry.RegisterService(ctx, grpcSvc, logger); err != nil {
if err := registry.RegisterService(ctx, logger, grpcSvc, cfg.Debug.Addr); err != nil {
logger.Fatal().Err(err).Msg("failed to register the grpc service")
}
httpScv := registry.BuildHTTPService(cfg.HTTP.Namespace+"."+cfg.Service.Name, cfg.HTTP.Addr, version.GetString())
if err := registry.RegisterService(ctx, httpScv, logger); err != nil {
httpSvc := registry.BuildHTTPService(cfg.HTTP.Namespace+"."+cfg.Service.Name, cfg.HTTP.Addr, version.GetString())
if err := registry.RegisterService(ctx, logger, httpSvc, cfg.Debug.Addr); err != nil {
logger.Fatal().Err(err).Msg("failed to register the http service")
}