Cocoar.Configuration
5.0.0
dotnet add package Cocoar.Configuration --version 5.0.0
NuGet\Install-Package Cocoar.Configuration -Version 5.0.0
<PackageReference Include="Cocoar.Configuration" Version="5.0.0" />
<PackageVersion Include="Cocoar.Configuration" Version="5.0.0" />
<PackageReference Include="Cocoar.Configuration" />
paket add Cocoar.Configuration --version 5.0.0
#r "nuget: Cocoar.Configuration, 5.0.0"
#:package Cocoar.Configuration@5.0.0
#addin nuget:?package=Cocoar.Configuration&version=5.0.0
#tool nuget:?package=Cocoar.Configuration&version=5.0.0
Reactive, strongly-typed configuration layering for .NET
Zero ceremony configuration that updates itself. Define a class, add a rule, inject it — no IOptions<T> wrappers, no Configure<T>() calls.
Install
dotnet add package Cocoar.Configuration # Core library (console apps)
dotnet add package Cocoar.Configuration.DI # + Microsoft.Extensions.DI
dotnet add package Cocoar.Configuration.AspNetCore # + health endpoints, feature flags
You only need one — each includes everything above it. Requires .NET 8+.
Quick Start
var builder = WebApplication.CreateBuilder(args);
builder.AddCocoarConfiguration(c => c
.UseConfiguration(rule => [
rule.For<AppSettings>().FromFile("appsettings.json"),
rule.For<AppSettings>().FromEnvironment("APP_"),
]));
var app = builder.Build();
// Inject directly — no wrapper
app.MapGet("/settings", (AppSettings settings) => new
{
settings.AppName,
settings.MaxRetries
});
app.Run();
Key Features
- Zero Ceremony — Define a class, add a rule, inject it. Just your POCO.
- Reactive by Default —
IReactiveConfig<T>updates automatically when sources change. - Atomic Updates —
IReactiveConfig<(T1, T2)>guarantees consistent snapshots across types. - Explicit Layering — Rules execute in order, last write wins. File, environment, CLI, HTTP.
- Memory-Safe Secrets —
Secret<T>with automatic zeroization and X.509 hybrid encryption. - Feature Flags & Entitlements — Strongly-typed, source-generated, with expiry health monitoring.
- Health Monitoring — Per-rule status tracking, OpenTelemetry metrics, ASP.NET Core health checks.
- Compile-Time Validation — Roslyn analyzers catch configuration errors in your IDE.
- First-Class Testing —
CocoarTestConfigurationwithAsyncLocal<T>isolation.
Providers
| Provider | Fluent API | Package |
|---|---|---|
| File (JSON) | .FromFile("path") |
Core |
| Environment Variables | .FromEnvironment("PREFIX_") |
Core |
| Command Line | .FromCommandLine("--prefix") |
Core |
| Static / Observable | .FromStaticJson() / .FromObservable() |
Core |
| HTTP | .FromHttp(url) |
Http |
| Microsoft IConfiguration | .FromIConfiguration(config) |
MicrosoftAdapter |
Examples
Explore real-world scenarios in the examples directory.
Contributing
Contributions welcome! See CONTRIBUTING.md for guidelines.
License
Apache-2.0 — see NOTICE for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Cocoar.Capabilities (>= 1.2.0)
- Cocoar.Configuration.Abstractions (>= 5.0.0)
- Cocoar.FileSystem (>= 2.2.0)
- Cocoar.Json.Mutable (>= 1.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
-
net9.0
- Cocoar.Capabilities (>= 1.2.0)
- Cocoar.Configuration.Abstractions (>= 5.0.0)
- Cocoar.FileSystem (>= 2.2.0)
- Cocoar.Json.Mutable (>= 1.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.2)
NuGet packages (7)
Showing the top 5 NuGet packages that depend on Cocoar.Configuration:
| Package | Downloads |
|---|---|
|
Cocoar.Configuration.AspNetCore
ASP.NET Core integration for Cocoar.Configuration. Health check endpoints, feature flag and entitlement REST evaluation endpoints, and WebApplicationBuilder extensions. |
|
|
Cocoar.Configuration.MicrosoftAdapter
Adapter for bridging Microsoft.Extensions.Configuration (IConfiguration) with Cocoar.Configuration, enabling gradual migration and coexistence with existing Microsoft configuration sources while leveraging reactive updates. |
|
|
Cocoar.Configuration.HttpPolling
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. |
|
|
Cocoar.Configuration.DI
Dependency injection integration for Cocoar.Configuration. Configuration type registration, lifetime customization, keyed services, and context resolver registration for feature flags and entitlements. |
|
|
Cocoar.Configuration.Secrets
Secure secrets management for Cocoar.Configuration using hybrid RSA+AES encryption. Store encrypted secrets directly in JSON configuration files with X.509 certificate-based decryption and automatic memory zeroing. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.0.0 | 136 | 3/24/2026 |
| 5.0.0-beta.8 | 32 | 3/24/2026 |
| 5.0.0-beta.2 | 77 | 3/19/2026 |
| 4.3.0-flags.4 | 53 | 3/10/2026 |
| 4.3.0-beta.3 | 39 | 3/19/2026 |
| 4.2.1 | 213 | 2/3/2026 |
| 4.2.0 | 155 | 2/3/2026 |
| 4.2.0-master-backplane-arch... | 65 | 2/3/2026 |
| 4.2.0-master-backplane-arch... | 64 | 2/2/2026 |
| 4.2.0-master-backplane-arch... | 55 | 2/2/2026 |
| 4.2.0-master-backplane-arch... | 62 | 2/1/2026 |
| 4.2.0-beta.5 | 62 | 1/30/2026 |
| 4.2.0-beta.4 | 58 | 1/30/2026 |
| 4.2.0-beta.3 | 57 | 1/30/2026 |
| 4.2.0-beta.2 | 64 | 1/30/2026 |
| 4.2.0-beta.1 | 58 | 1/30/2026 |
| 4.1.0 | 170 | 1/11/2026 |
| 4.0.0 | 165 | 1/8/2026 |
| 3.4.0-secrets.36 | 214 | 11/16/2025 |
| 3.4.0-beta.6 | 255 | 11/16/2025 |
Full release notes: https://github.com/cocoar-dev/cocoar.configuration/blob/develop/CHANGELOG.md