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.
IReactiveConfig<T> (no opt-in).IReactiveConfig<(T1,T2,...,TN)> for atomic aligned multi-config state (any tuple arity) with strict validation.docs/health-monitoring.md).IOptions<T> ceremony).Fetch → Select → Mount → Merge.__ / : hierarchy mapping.IConfiguration (extension package).IConfigurationHealthService.IReactiveConfig<T> & tuple variants auto available..DisableAutoRegistration() (concrete) or global setup.ExposedType<IMy>().DisableAutoRegistration().dotnet add package Cocoar.Configuration
# For ASP.NET Core integration:
dotnet add package Cocoar.Configuration.AspNetCorevar builder = WebApplication.CreateBuilder(args);
builder.Services.AddCocoarConfiguration(rule => [
rule.File("appsettings.json").Select("App").For<AppSettings>(),
rule.Environment("APP_").For<AppSettings>()
], setup => [
setup.ConcreteType<AppSettings>()
.ExposeAs<IAppSettings>() // optional interface exposure
]);
var app = builder.Build();
// Interface injection (Scoped)
app.MapGet("/feature", (IAppSettings cfg) => new { cfg.FeatureFlag, cfg.Message });
// Reactive tuple injection
app.MapGet("/composite", (IReactiveConfig<(AppSettings App, LoggingConfig Log)> composite) =>
{
var (appCfg, log) = composite.CurrentValue;
return new { appCfg.Version, log.Level };
});
app.Run();// Inside your configure function:
builder.AddCocoarConfiguration(rule => [
rule.File("appsettings.json").For<AppSettings>()
], setup => [
// Skip concrete registration
setup.ConcreteType<AppSettings>().DisableAutoRegistration(),
// Globally suppress interface registration (affects any future exposure of IAppSettings)
setup.ExposedType<IAppSettings>().DisableAutoRegistration()
]);| Project | Description |
|---|---|
| BasicUsage | ASP.NET Core + file + environment overlay |
| FileLayering | Multi-file layering (base/env/local) |
| DynamicDependencies | Rules derived from earlier snapshots |
| AspNetCoreExample | Minimal API endpoints exposing config |
| GenericProviderAPI | Using generic provider registration APIs |
| HttpPollingExample | Remote HTTP polling pattern |
| MicrosoftAdapterExample | Integrate existing IConfigurationSource providers |
| StaticProviderExample | Static seeding with JSON / factories |
| SimplifiedCoreExample | Pure core (no DI) usage |
| BindingExample | Interface exposure without DI container |
| TupleReactiveExample | Tuple-based aligned reactive snapshots |
More: Examples README.
Extensive automated test suite (>200 tests) spanning:
See the Testing Guide for details.
LICENSE, NOTICE)This project is licensed under the Apache License, Version 2.0. See NOTICE for attribution.
“Cocoar” and related marks are trademarks of COCOAR e.U. Usage in forks should preserve attribution and avoid implying endorsement. See TRADEMARKS.