# ZB.MOM.WW.Configuration Startup configuration-validation library for the **ZB.MOM.WW SCADA family** (OtOpcUa, MxAccessGateway, ScadaBridge). These are **libraries, not a service** — the package is linked directly into the consuming application at build time. There is no central validation process; all validation runs in-process at startup. The library normalizes the three-project configuration-validation surface: a failure-accumulating `IValidateOptions` base, reusable rule primitives, a bind+validate+`ValidateOnStart` DI extension, and a pre-host `ConfigPreflight` aggregator for raw `IConfiguration` — so the plumbing is written once and domain rules stay per-project. **Built at 0.1.0. Adopted by OtOpcUa, MxAccessGateway, and ScadaBridge on 2026-06-01** (local default branches; not yet pushed to remotes). Adoption tracked in `~/Desktop/scadaproj/components/configuration/GAPS.md`. --- ## Package | Package | Responsibilities | Key Dependencies | |---|---|---| | `ZB.MOM.WW.Configuration` | `OptionsValidatorBase` (abstract `IValidateOptions` base, failure-accumulating), `ValidationBuilder` (rule primitives: `Required`, `Port`, `HostPort`, `PositiveTimeSpan`, `OneOf`, `MinCount`, `RequireThat`, `Add`), `ServiceCollectionExtensions.AddValidatedOptions` (bind + validator + `ValidateOnStart` in one call), `ConfigPreflight` (fluent pre-host raw-`IConfiguration` checker). | `Microsoft.Extensions.Options`, `Microsoft.Extensions.Options.ConfigurationExtensions`, `Microsoft.Extensions.Configuration.Abstractions`, `Microsoft.Extensions.DependencyInjection.Abstractions` | Single package; no ASP.NET Core framework reference. --- ## Build, test, and pack commands ```bash # From ZB.MOM.WW.Configuration/ # Build dotnet build ZB.MOM.WW.Configuration.slnx # Test (no external dependencies required) dotnet test ZB.MOM.WW.Configuration.slnx # Pack (one .nupkg lands in artifacts/) dotnet pack ZB.MOM.WW.Configuration.slnx -c Release -o ./artifacts ``` Test breakdown: | Assembly | Tests | |---|---| | `ZB.MOM.WW.Configuration.Tests` | 27 | | **Total** | **27** | `GeneratePackageOnBuild` is off — pack explicitly with the command above. --- ## Source layout ``` ZB.MOM.WW.Configuration/ ├── Directory.Build.props # version (0.1.0), TFM (net10.0), central package mgmt ├── Directory.Packages.props # pinned package versions ├── ZB.MOM.WW.Configuration.slnx # solution file ├── src/ │ └── ZB.MOM.WW.Configuration/ # library project │ ├── OptionsValidatorBase.cs │ ├── ValidationBuilder.cs │ ├── Checks.cs # internal shared rule wording │ ├── ServiceCollectionExtensions.cs │ └── ConfigPreflight.cs └── tests/ └── ZB.MOM.WW.Configuration.Tests/ # xUnit test project (27 tests) ``` --- ## Status Part of the **scadaproj component-normalization family** — this is the configuration + validation component. Built at **0.1.0**. **Adopted by OtOpcUa, MxAccessGateway, and ScadaBridge on 2026-06-01** (local default branches; not yet pushed to remotes) — per-app result is tracked in: - `~/Desktop/scadaproj/components/configuration/GAPS.md` Design documentation: - `~/Desktop/scadaproj/components/configuration/spec/SPEC.md` — normalized validation target - `~/Desktop/scadaproj/components/configuration/shared-contract/ZB.MOM.WW.Configuration.md` — proposed shared-library API - `~/Desktop/scadaproj/components/configuration/current-state/` — per-project current state (code-verified)