HTTP polling provider for Cocoar.Configuration enabling remote configuration sources with configurable polling intervals, automatic retries, and failure sentinel values for resilient distributed configuration management.
$ dotnet add package Cocoar.Configuration.HttpPolling
Lightweight, strongly-typed, deterministic multi-source configuration layering for .NET (Current target framework: net9.0).
Deterministic, strongly-typed, rule-driven configuration layering that complements Microsoft.Extensions.Configuration.
IOptions<T> ceremony).IConfigurationSource via the Microsoft Adapter package.Supported TFM: net9.0 (multi-targeting planned).
<ItemGroup>
<PackageReference Include="Cocoar.Configuration" />
<!-- Optional extensions -->
<PackageReference Include="Cocoar.Configuration.AspNetCore" />
<PackageReference Include="Cocoar.Configuration.HttpPolling" />
<PackageReference Include="Cocoar.Configuration.MicrosoftAdapter" />
</ItemGroup>CLI:
dotnet add package Cocoar.Configuration
dotnet add package Cocoar.Configuration.AspNetCore
dotnet add package Cocoar.Configuration.HttpPolling
dotnet add package Cocoar.Configuration.MicrosoftAdapterMinimal example (file + environment layering, strongly-typed access):
// ...
builder
.AddCocoarConfiguration(
// File + env layering (rule-level selection via .Select)
Rule.From.File("appsettings.json").Select("App").For<AppSettings>().Optional(),
Rule.From.Environment("APP_").For<AppSettings>()
);Then inject your config type directly:
var settings = app.Services.GetRequiredService<AppSettings>();
Console.WriteLine($"FeatureX: {settings.EnableFeatureX}");Built-in and extension providers:
| Provider | Package | Change Signal | Notes |
|---|---|---|---|
| Static | Core | ❌ | Seed defaults, compose values |
| File (JSON) | Core | ✅ Filesystem watcher | Deterministic layering |
| Environment | Core | ❌ | Prefix filter; __ & : nesting |
| HTTP Polling | Extension | ✅ | Interval polling, payload diffing |
| Microsoft Adapter | Extension | Depends | Any IConfigurationSource |
👉 See Providers Overview for full details.
Rule.From.Provider<>() for full controlIConfigurationSource👉 Details in Advanced Features
Multi-project solution under src/Examples/ with runnable demos:
IConfigurationSourceFor more in-depth documentation, see:
UseWhen to toggle)This project invests heavily in correctness-first incremental recompute. Optimisations (prefix reuse, cancellation, selection‑hash gating, debounce) are all guarded by strong differential and stress tests so performance never compromises determinism.
Core test suites (see src/tests/):
| Suite | Focus | Guarantee |
|---|---|---|
DifferentialCorrectnessFuzzTests | Random multi-provider mutation waves | Final published snapshot bit-for-bit equals a naive full merge |
PartialRecomputeTests | Prefix reuse / earliest-index accuracy | Unchanged prefix providers are never refetched |
OverlappingRecomputeCorrectnessTests | Cancellation under descending storms | No lost updates; latest versions survive heavy overlap |
CancellationTests | Mid-pass abort & restart | Earlier changes preempt wasted later work |
SnapshotChangeDeletionTests | Deletion propagation | Removed keys do not resurrect spuriously |
RecomputeStressTests | Burst & jitter durability | Bounded passes; stable end-state |
Provider suites (Providers/*Tests) | Integration of file/env/http/adapter | Source-specific semantics remain correct |
Why call this out? Incremental configuration layering is deceptively complex once you introduce cancellation and reuse. Many libraries silently drop updates or leak stale keys; these suites explicitly prevent that class of regression.
Packages are published under the NuGet organization cocoar.
Issues and PRs are welcome 🎉 Keep provider abstractions stable & deterministic. Examples and docs are validated in CI.
(This README reflects the current state – future optimizations & multi-targeting will be documented in docs/.)