Skip to content

Repository files navigation

ConfigDirector .NET SDKs

CI NuGet ServerSdk NuGet AspNetCore NuGet Testing NuGet AspNetCore Testing NuGet OpenFeature

.NET server SDK and OpenFeature server provider for ConfigDirector, remote config and feature flags with typed values, JSON Schema validation, and safe renames of live flags. Start free, no card required.

Each package carries its own README and changelog:

Install

dotnet add package ConfigDirector.ServerSdk

In an ASP.NET Core application, add ConfigDirector.ServerSdk.AspNetCore instead; it registers the client, binds its settings from configuration, connects before the server starts listening, and disposes it on shutdown.

To read configs through the OpenFeature API instead, add ConfigDirector.OpenFeature.ServerProvider, which brings the server SDK and the OpenFeature .NET SDK with it.

Retrieve a value

using ConfigDirector;

// The server SDK key is a secret. Do not commit it to your source code.
await using var client = new ConfigDirectorClient("YOUR-SERVER-SDK-KEY");
await client.InitializeAsync();

var newCheckout = client.GetValue("new-checkout", false);

Full details are in the official documentation.

Test your code

ConfigDirector.ServerSdk.Testing creates a test client: the real client connected to an in-memory server that your test seeds and changes, with no network and no telemetry. In an ASP.NET Core application, ConfigDirector.ServerSdk.AspNetCore.Testing registers it with the application under test.

using ConfigDirector.Testing;

await using var testClient = ConfigDirectorTesting.CreateTestClient(
    new Dictionary<string, object> { ["new-checkout"] = true });
await testClient.Client.InitializeAsync();

var newCheckout = testClient.Client.GetValue("new-checkout", false);

Retrieve a value through OpenFeature

using ConfigDirector.OpenFeature;
using OpenFeature;

await Api.Instance.SetProviderAsync(new ConfigDirectorProvider("YOUR-SERVER-SDK-KEY"));
var client = Api.Instance.GetClient();

var newCheckout = await client.GetBooleanValueAsync("new-checkout", false);

Full details are in the official documentation for the OpenFeature .NET provider.

Documentation

Refer to the official documentation for the .NET SDK and the OpenFeature .NET provider.

There is also a quickstart guide for ConfigDirector and any of our SDKs.

Sample apps

samples/ holds small, runnable applications built on this SDK. They are the same app written each way -- a single /configs endpoint -- so they can be read side by side. The web samples each come with a test project showing how to test an application against the testing packages, or against OpenFeature's in-memory provider.

ConfigDirector.Samples.MinimalApi:

dotnet run --project samples/ConfigDirector.Samples.MinimalApi

ConfigDirector.Samples.Mvc, the same app wired up with the ConfigDirector.ServerSdk.AspNetCore package rather than by hand:

dotnet run --project samples/ConfigDirector.Samples.Mvc

ConfigDirector.Samples.NativeAot, a console application published to native code:

dotnet run --project samples/ConfigDirector.Samples.NativeAot

ConfigDirector.Samples.OpenFeature, the same app reading every value through an OpenFeature client, with the ConfigDirector.OpenFeature.ServerProvider package registered through OpenFeature.Hosting:

dotnet run --project samples/ConfigDirector.Samples.OpenFeature

ConfigDirector.Samples.OpenFeature.NativeAot, the OpenFeature provider in a console application published to native code:

dotnet run --project samples/ConfigDirector.Samples.OpenFeature.NativeAot

Getting Help

Releases

Used by

Contributors

Languages