Files
wwtools/mbproxy/install/mbproxy.config.template.json
T
Joseph Doherty 0756bb0066 mbproxy/install: slim config templates, point to Configuration.md
The publish-out appsettings templates carried ~250 lines of mostly
prose — BCD/CDAB encoding, coalescing rationale, the full cache
contract — all of which is already documented in
docs/Operations/Configuration.md. Replaced the prose with brief
per-section pointers and a header directing operators to that
reference; all config values are unchanged. Also dropped a stale
comment claiming a 1:1 connection model and a 4-client cap (lifted by
the Phase-9 TxId multiplexer).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 18:18:59 -04:00

117 lines
4.9 KiB
JSON

// mbproxy configuration. Copy to %ProgramData%\mbproxy\appsettings.json and edit
// before starting the service. install.ps1 seeds this file only when none exists —
// an existing appsettings.json is always preserved across reinstalls.
//
// JSONC: // and /* */ comments are accepted. The file is hot-reloaded on save.
//
// FULL REFERENCE — every key, type, default, range, validation rule and hot-reload
// behaviour — lives in docs/Operations/Configuration.md. The notes below are brief
// pointers only; consult that document before editing.
{
"Mbproxy": {
// Fleet-wide BCD tag list — applies to every PLC. Each entry: Address (Modbus
// PDU-decimal), Width (16 or 32), optional Name (debug-view label) and CacheTtlMs.
// Per-PLC Add/Remove overrides go under Plcs[].BcdTags. Trailing comments give the
// 4xxxx Modbus address and the DirectLOGIC V-memory reference.
"BcdTags": {
"Global": [
// 16-bit setpoints
{ "Address": 1536, "Width": 16, "Name": "Left ArgonSP" }, // 41537
{ "Address": 1539, "Width": 16, "Name": "Right ArgonSP" }, // 41540
{ "Address": 1544, "Width": 16, "Name": "Left ChlorineSP" }, // 41545 · V3010
{ "Address": 1545, "Width": 16, "Name": "Right ChlorineSP" }, // 41546 · V3011
{ "Address": 1546, "Width": 16, "Name": "Left HydrogenSP" }, // 41547 · V3012
{ "Address": 1547, "Width": 16, "Name": "Right HydrogenSP" }, // 41548 · V3013
{ "Address": 1548, "Width": 16, "Name": "Left AirSP" }, // 41549 · V3014
{ "Address": 1549, "Width": 16, "Name": "Right AirSP" }, // 41550 · V3015
// 32-bit runtimes — CDAB pair spanning Address and Address+1
{ "Address": 4616, "Width": 32, "Name": "MTA Runtime Left (min)" }, // 44617/44618 · V11010
{ "Address": 4618, "Width": 32, "Name": "MTA Runtime Right (min)" }, // 44619/44620 · V11012
{ "Address": 4626, "Width": 32, "Name": "FRR Runtime Left (min)" }, // 44627/44628 · V11022
{ "Address": 4628, "Width": 32, "Name": "FRR Runtime Right (min)" } // 44629/44630 · V11024
]
},
// One entry per PLC: upstream clients connect to ListenPort, the proxy forwards to
// Host:Port. ListenPort must be unique. Optional per-PLC "BcdTags": { "Add", "Remove" }.
"Plcs": [
{
"Name": "Z28061",
"ListenPort": 5020,
"Host": "10.210.192.5",
"Port": 502
}
],
// Read-only HTTP status page / dashboard. Set to 0 to disable the admin endpoint.
"AdminPort": 8080,
// Backend connect / request / graceful-shutdown timeouts (ms), plus TCP keepalive
// and the idle-backend FC03 heartbeat. BackendHeartbeatIdleMs must exceed
// BackendRequestTimeoutMs. See docs/Architecture/Keepalive.md.
"Connection": {
"BackendConnectTimeoutMs": 3000,
"BackendRequestTimeoutMs": 3000,
"GracefulShutdownTimeoutMs": 10000,
"Keepalive": {
"Enabled": true,
"TcpIdleTimeMs": 30000,
"TcpProbeIntervalMs": 5000,
"TcpProbeCount": 4,
"BackendHeartbeatIdleMs": 30000,
"BackendHeartbeatProbeAddress": 0
}
},
// Polly policies: backend-connect retry, listener-bind recovery, read coalescing.
// BackendConnect / ListenerRecovery are restart-only (not hot-reloaded).
"Resilience": {
"BackendConnect": { "MaxAttempts": 3, "BackoffMs": [ 100, 500, 2000 ] },
"ListenerRecovery": { "InitialBackoffMs": [ 1000, 2000, 5000, 15000, 30000 ], "SteadyStateMs": 30000 },
"ReadCoalescing": { "Enabled": true, "MaxParties": 32 }
},
// Opt-in response cache — OFF by default per tag. A tag opts in via its CacheTtlMs
// (or a PLC's DefaultCacheTtlMs); these are service-wide safety knobs only.
// See docs/Architecture/ResponseCache.md.
"Cache": {
"AllowLongTtl": false,
"MaxEntriesPerPlc": 1000,
"EvictionIntervalMs": 5000
}
},
// Structured logging — console + daily rolling file under %ProgramData%\mbproxy\logs.
// Error+ events also go to the Windows Application Event Log under the SCM (wired in
// code, not here). See docs/Operations/Troubleshooting.md.
"Serilog": {
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File" ],
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} {Properties:j}{NewLine}{Exception}"
}
},
{
"Name": "File",
"Args": {
"path": "C:\\ProgramData\\mbproxy\\logs\\mbproxy-.log",
"rollingInterval": "Day",
"retainedFileCountLimit": 30,
"outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} {Level:u3}] {Message:lj} {Properties:j}{NewLine}{Exception}"
}
}
]
}
}