feat: add GrpcPort config to NodeOptions with startup validation
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
"Role": "Site",
|
||||
"NodeHostname": "localhost",
|
||||
"SiteId": "site-a",
|
||||
"RemotingPort": 8082
|
||||
"RemotingPort": 8082,
|
||||
"GrpcPort": 8083
|
||||
},
|
||||
"Cluster": {
|
||||
"SeedNodes": [
|
||||
|
||||
Reference in New Issue
Block a user