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(
Rule.From.File(_ => FileSourceRuleOptions.FromFilePath("appsettings.json", "App")).For<AppSettings>().Optional(),
Rule.From.Environment(_ => new EnvironmentVariableRuleOptions("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:
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/.)