fix(scadabridge): default MetricsPort to 8084 (avoid site RemotingPort collision) + validate port distinctness
This commit is contained in:
@@ -58,6 +58,21 @@ public static class StartupValidator
|
||||
if (port == grpcPort)
|
||||
errors.Add("ScadaBridge:Node:GrpcPort must differ from RemotingPort");
|
||||
|
||||
var metricsPortStr = nodeSection["MetricsPort"];
|
||||
int metricsPort = 8084; // NodeOptions default when the key is absent
|
||||
if (metricsPortStr != null && (!int.TryParse(metricsPortStr, out metricsPort) || metricsPort < 1 || metricsPort > 65535))
|
||||
errors.Add("ScadaBridge:Node:MetricsPort must be 1-65535");
|
||||
|
||||
// Host-007 / REQ-HOST-4: the Kestrel metrics (HTTP/1.1) listener port
|
||||
// must differ from BOTH the Akka remoting port and the gRPC port.
|
||||
// A collision makes the metrics listener contend with Akka.Remote or
|
||||
// the gRPC listener for the same TCP port and fail opaquely at runtime.
|
||||
// Uses the resolved MetricsPort, including the 8084 default.
|
||||
if (metricsPort == port)
|
||||
errors.Add("ScadaBridge:Node:MetricsPort must differ from RemotingPort");
|
||||
if (metricsPort == grpcPort)
|
||||
errors.Add("ScadaBridge:Node:MetricsPort must differ from GrpcPort");
|
||||
|
||||
var dbSection = configuration.GetSection("ScadaBridge:Database");
|
||||
if (string.IsNullOrEmpty(dbSection["SiteDbPath"]))
|
||||
errors.Add("ScadaBridge:Database:SiteDbPath required for Site nodes");
|
||||
|
||||
Reference in New Issue
Block a user