Validate PublicClient Hostport parsable
@@ -22,6 +22,7 @@ package temporal
import (
"log"
+ "net"
"time"
"go.temporal.io/temporal-proto/workflowservice"
@@ -163,6 +164,18 @@ func (s *server) startService() common.Daemon {
clusterMetadata.ReplicationConsumer,
)
+ if s.cfg.PublicClient.HostPort == "" {
+ log.Fatalf("need to provide an endpoint config for PublicClient")
+ } else if h, _, err := net.SplitHostPort(s.cfg.PublicClient.HostPort); err != nil || len(h) == 0 {
+ log.Fatalf("Malformed PublicClient HostPort, must be host:port - '%v' - Error - %v", s.cfg.PublicClient.HostPort, err)
+ } else {
+ connection, err := rpc.Dial(s.cfg.PublicClient.HostPort)
+ if err != nil {
+ log.Fatalf("failed to dial gRPC connection: %v", err)
+ }
+ params.PublicClient = workflowservice.NewWorkflowServiceClient(connection)
+ }
+
advancedVisMode := dc.GetStringProperty(
dynamicconfig.AdvancedVisibilityWritingMode,
common.GetDefaultAdvancedVisibilityWritingMode(params.PersistenceConfig.IsAdvancedVisibilityConfigExist()),
@@ -198,15 +211,6 @@ func (s *server) startService() common.Daemon {
}
}
- if s.cfg.PublicClient.HostPort == "" {
- log.Fatalf("need to provide an endpoint config for PublicClient")
- }
- connection, err := rpc.Dial(s.cfg.PublicClient.HostPort)
- if err != nil {
- log.Fatalf("failed to dial gRPC connection: %v", err)
- }
- params.PublicClient = workflowservice.NewWorkflowServiceClient(connection)
-
params.ArchivalMetadata = archiver.NewArchivalMetadata(
dc,
s.cfg.Archival.History.Status,
