feat: add GrpcPort config to NodeOptions with startup validation

This commit is contained in:
Joseph Doherty
2026-03-21 11:42:41 -04:00
parent deb58e1f17
commit 64ee316609
4 changed files with 44 additions and 1 deletions

View File

@@ -6,4 +6,5 @@ public class NodeOptions
public string NodeHostname { get; set; } = string.Empty;
public string? SiteId { get; set; }
public int RemotingPort { get; set; } = 8081;
public int GrpcPort { get; set; } = 8083;
}

View File

@@ -42,6 +42,10 @@ public static class StartupValidator
if (role == "Site")
{
var grpcPortStr = nodeSection["GrpcPort"];
if (grpcPortStr != null && (!int.TryParse(grpcPortStr, out var gp) || gp < 1 || gp > 65535))
errors.Add("ScadaLink:Node:GrpcPort must be 1-65535");
var dbSection = configuration.GetSection("ScadaLink:Database");
if (string.IsNullOrEmpty(dbSection["SiteDbPath"]))
errors.Add("ScadaLink:Database:SiteDbPath required for Site nodes");

View File

@@ -4,7 +4,8 @@
"Role": "Site",
"NodeHostname": "localhost",
"SiteId": "site-a",
"RemotingPort": 8082
"RemotingPort": 8082,
"GrpcPort": 8083
},
"Cluster": {
"SeedNodes": [