fix(options): canonicalize Communication/DataConnection config sections to ScadaBridge:*; drop the duplicate Host bindings that were masking the drift (plan R2-08 T9, arch-review 08r2 NF8)

This commit is contained in:
Joseph Doherty
2026-07-13 10:58:28 -04:00
parent 973e59de84
commit 7943d73e71
9 changed files with 119 additions and 42 deletions
@@ -12,8 +12,12 @@ public static class ServiceCollectionExtensions
/// <returns>The same <see cref="IServiceCollection"/> to allow chaining.</returns>
public static IServiceCollection AddCommunication(this IServiceCollection services)
{
// Canonical section is ScadaBridge:Communication — the section every real
// appsettings actually writes (arch-review 08 round 2 NF8). The Host used to
// supply the real values via a duplicate Configure<> binding; that duplicate is
// gone, so AddCommunication must bind the canonical section itself.
services.AddOptions<CommunicationOptions>()
.BindConfiguration("Communication")
.BindConfiguration("ScadaBridge:Communication")
.ValidateOnStart();
services.TryAddEnumerable(
ServiceDescriptor.Singleton<IValidateOptions<CommunicationOptions>, CommunicationOptionsValidator>());