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:
@@ -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>());
|
||||
|
||||
Reference in New Issue
Block a user