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
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Musement.Extensions.Configuration.ConfigCat" Version="3.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Musement.Extensions.Configuration.ConfigCat --version 3.0.0
#r "nuget: Musement.Extensions.Configuration.ConfigCat, 3.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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

Build status Nuget package

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.0 5,471 2/21/2023
2.0.2 1,379 10/25/2022
2.0.0 410 10/24/2022
1.0.4 18,928 11/11/2021
1.0.3 286 11/11/2021
1.0.2 285 11/11/2021
0.9.0 323 11/11/2021