Musement.Extensions.Configuration.ConfigCat
3.0.0
dotnet add package Musement.Extensions.Configuration.ConfigCat --version 3.0.0
NuGet\Install-Package Musement.Extensions.Configuration.ConfigCat -Version 3.0.0
<PackageReference Include="Musement.Extensions.Configuration.ConfigCat" Version="3.0.0" />
paket add Musement.Extensions.Configuration.ConfigCat --version 3.0.0
#r "nuget: Musement.Extensions.Configuration.ConfigCat, 3.0.0"
// Install Musement.Extensions.Configuration.ConfigCat as a Cake Addin #addin nuget:?package=Musement.Extensions.Configuration.ConfigCat&version=3.0.0 // Install Musement.Extensions.Configuration.ConfigCat as a Cake Tool #tool nuget:?package=Musement.Extensions.Configuration.ConfigCat&version=3.0.0
This repository contains a provider for Microsoft.Extensions.Configuration that maps configuration stored in ConfigCat
Overview
Storing configuration and feature flags in environment variables or
appsettings.json
may require a new deploy of the application to update
something in some cases. This package extends the default configuration
pipeline used in ASP.NET applications (or any other application that uses
Microsoft.Extensions.Configuration really) to take advantage of remote
configuration via ConfigCat.
The repo contains a sample application, but this is how an application will look like:
public class Program
{
public static Task Main(string[] args)
{
Host.CreateDefaultBuilder(args)
.ConfigureAppConfiguration((hostingContext, builder) =>
{
builder.AddConfigCat(configCatOptions =>
{
configCatOptions.Configuration = c =>
{
c.SdkKey = YOUR_SDK_KEY;
};
})
})
.Build()
.Run();
}
}
We recommend storing the SDK key in a secure location, like AWS SecretsManager or Azure KeyVault.
Configuration
You can use the lambda parameter in the AddConfigCat
extension method to
customize the behavior of the application.
The first obvious part is the Configuration
property, which is then passed
to the ConfigCat SDK internally. This is an AutoPollConfiguration
because
the library will automatically update the configuration on a timer, which you
can configure from this object. You can get more info about this object in the
official ConfigCat SDK docs.
The options object also lets you set a filter (KeyFilter
) for the keys you
want to import, this is just a lambda function that returns true
or false
respectively if you want to import a configuration key or not.
The default always returns true
.
The KeyMapper
lambda lets you customize how the ConfigCat key is transformed
into a IConfiguration key. The default works like how environment variables
work with IConfiguration, with double underscores (__
) being transformed in
section delimiters so that FOO__BAR
gets mapped as FOO:BAR
.
Last but not least, the CreateClient
lambda gives you an opportunity to
override how the ConfigCat client is created.
The Configuration
object from above is passed as the only parameter.
Versioning
This library follows Semantic Versioning for the public releases.
Releases
Packages are automatically built and published on nuget by a Github Actions workflow triggered by tags.
How to build
This project uses the default dotnet
CLI.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net6.0
- ConfigCat.Client (>= 7.2.0)
- Microsoft.Extensions.Configuration (>= 6.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.