Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<PackageVersion Include="Azure.Provisioning.AppContainers" Version="1.1.0" />
<PackageVersion Include="JsonSchema.Net" Version="7.4.0" />
<PackageVersion Include="OllamaSharp" Version="5.4.12" />
<PackageVersion Include="OpenFeature.Contrib.GOFeatureFlag" Version="0.2.1" />
<PackageVersion Include="OpenFeature.Providers.GOFeatureFlag" Version="1.0.0" />
<PackageVersion Include="Minio" Version="6.0.5" />
<PackageVersion Include="MassTransit" Version="8.5.5" />
<PackageVersion Include="MassTransit.ActiveMQ" Version="8.5.5" />
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ This repository contains the source code for the Aspire Community Toolkit, a col
| - **Learn More**: [`Hosting.RavenDB`][ravendb-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Hosting.RavenDB][ravendb-shields]][ravendb-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.RavenDB][ravendb-shields-preview]][ravendb-nuget-preview] | An Aspire integration leveraging the [RavenDB](https://ravendb.net/) container. |
| - **Learn More**: [`RavenDB.Client`][ravendb-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.RavenDB.Client][ravendb-client-shields]][ravendb-client-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.RavenDB.Client][ravendb-client-shields-preview]][ravendb-client-nuget-preview] | An Aspire client integration for the [RavenDB.Client](https://www.nuget.org/packages/RavenDB.client) package. |
| - **Learn More**: [`Hosting.GoFeatureFlag`][go-feature-flag-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Hosting.GoFeatureFlag][go-feature-flag-shields]][go-feature-flag-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.GoFeatureFlag][go-feature-flag-shields-preview]][go-feature-flag-nuget-preview] | An Aspire hosting integration leveraging the [GoFeatureFlag](https://gofeatureflag.org/) container. |
| - **Learn More**: [`GoFeatureFlag`][go-feature-flag-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.GoFeatureFlag][go-feature-flag-client-shields]][go-feature-flag-client-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.GoFeatureFlag][go-feature-flag-client-shields-preview]][go-feature-flag-client-nuget-preview] | An Aspire client integration for the [GoFeatureFlag](https://github.com/open-feature/dotnet-sdk-contrib/tree/main/src/OpenFeature.Contrib.Providers.GOFeatureFlag) package. |
| - **Learn More**: [`GoFeatureFlag`][go-feature-flag-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.GoFeatureFlag][go-feature-flag-client-shields]][go-feature-flag-client-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.GoFeatureFlag][go-feature-flag-client-shields-preview]][go-feature-flag-client-nuget-preview] | An Aspire client integration for the [GoFeatureFlag](https://github.com/open-feature/dotnet-sdk-contrib/tree/main/src/OpenFeature.Providers.GOFeatureFlag) package. |
| - **Learn More**: [`Hosting.MongoDB.Extensions`][mongodb-ext-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.MongoDB.Extensions][mongodb-ext-shields]][mongodb-ext-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.MongoDB.Extensions][mongodb-ext-shields-preview]][mongodb-ext-nuget-preview] | An integration that contains some additional extensions for hosting MongoDB container. |
| - **Learn More**: [`Hosting.PostgreSQL.Extensions`][postgres-ext-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.PostgreSQL.Extensions][postgres-ext-shields]][postgres-ext-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions][postgres-ext-shields-preview]][postgres-ext-nuget-preview] | An integration that contains some additional extensions for hosting PostgreSQL container. |
| - **Learn More**: [`Hosting.Redis.Extensions`][redis-ext-integration-docs] <br /> - Stable 📦: [![CommunityToolkit.Aspire.Redis.Extensions][redis-ext-shields]][redis-ext-nuget] <br /> - Preview 📦: [![CommunityToolkit.Aspire.Hosting.Redis.Extensions][redis-ext-shields-preview]][redis-ext-nuget-preview] | An integration that contains some additional extensions for hosting Redis container. |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using OpenFeature.Contrib.Providers.GOFeatureFlag;
using OpenFeature.Providers.GOFeatureFlag;
using OpenFeature.Model;

var builder = WebApplication.CreateBuilder(args);
Expand All @@ -14,17 +14,17 @@
// Currently supported flags are:
// - `display-banner`
app.MapGet(
"/features/{featureName}",
async (string featureName, GoFeatureFlagProvider provider, CancellationToken cancellationToken) =>
"/features/{featureName}",
async (string featureName, GOFeatureFlagProvider provider, CancellationToken cancellationToken) =>
{
var userContext = EvaluationContext.Builder()
.Set("targetingKey", Guid.NewGuid().ToString())
.Set("anonymous", true)
.Build();
var flag = await provider.ResolveBooleanValueAsync(featureName, false, userContext, cancellationToken);

return Results.Ok(flag);
})
.WithName("GetFeature");

app.Run();
app.Run();
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using OpenFeature.Contrib.Providers.GOFeatureFlag;
using OpenFeature.Providers.GOFeatureFlag;

namespace Microsoft.Extensions.Hosting;

Expand All @@ -23,7 +23,7 @@ public static class AspireGoFeatureFlagExtensions
/// </summary>
/// <param name="builder">The <see cref="IHostApplicationBuilder" /> to read config from and add services to.</param>
/// <param name="connectionName">The connection name to use to find a connection string.</param>
/// <param name="configureSettings">An optional method that can be used for customizing the <see cref="GoFeatureFlagProviderOptions"/>. It's invoked after the settings are read from the configuration.</param>
/// <param name="configureSettings">An optional method that can be used for customizing the <see cref="GOFeatureFlagProviderOptions"/>. It's invoked after the settings are read from the configuration.</param>
/// <remarks>Reads the configuration from "Aspire:GoFeatureFlag:Client" section.</remarks>
/// <exception cref="InvalidOperationException">If required ConnectionString is not provided in configuration section</exception>
public static void AddGoFeatureFlagClient(
Expand All @@ -41,7 +41,7 @@ public static void AddGoFeatureFlagClient(
/// </summary>
/// <param name="builder">The <see cref="IHostApplicationBuilder" /> to read config from and add services to.</param>
/// <param name="name">The connection name to use to find a connection string.</param>
/// <param name="configureSettings">An optional method that can be used for customizing the <see cref="GoFeatureFlagProviderOptions"/>. It's invoked after the settings are read from the configuration.</param>
/// <param name="configureSettings">An optional method that can be used for customizing the <see cref="GOFeatureFlagProviderOptions"/>. It's invoked after the settings are read from the configuration.</param>
/// <remarks>Reads the configuration from "Aspire:GoFeatureFlag:Client" section.</remarks>
/// <exception cref="InvalidOperationException">If required ConnectionString is not provided in configuration section</exception>
public static void AddKeyedGoFeatureFlagClient(
Expand Down Expand Up @@ -105,11 +105,11 @@ private static void AddGoFeatureFlagClient(
));
}

GoFeatureFlagProvider ConfigureGoFeatureFlagClient(GoFeatureFlagProviderOptions options)
GOFeatureFlagProvider ConfigureGoFeatureFlagClient(GOFeatureFlagProviderOptions options)
{
if (settings.Endpoint is not null)
{
return new GoFeatureFlagProvider(options);
return new GOFeatureFlagProvider(options);
}

throw new InvalidOperationException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" />
<PackageReference Include="OpenFeature.Contrib.GOFeatureFlag" />
<PackageReference Include="OpenFeature.Providers.GOFeatureFlag" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using OpenFeature.Contrib.Providers.GOFeatureFlag;
using OpenFeature.Providers.GOFeatureFlag;
using OpenFeature.Providers.GOFeatureFlag.Models;
using System.Data.Common;

namespace CommunityToolkit.Aspire.GoFeatureFlag;
Expand Down Expand Up @@ -34,7 +35,11 @@ public sealed class GoFeatureFlagClientSettings
/// <summary>
/// Gets or sets the provider options that will be used to configure the GO Feature Flag client.
/// </summary>
public GoFeatureFlagProviderOptions ProviderOptions { get; set; } = new();
public GOFeatureFlagProviderOptions ProviderOptions { get; set; } = new()
{
Endpoint = string.Empty,
EvaluationType = EvaluationType.Remote
};

internal void ParseConnectionString(string? connectionString)
{
Expand Down
2 changes: 1 addition & 1 deletion src/CommunityToolkit.Aspire.GoFeatureFlag/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CommunityToolkit.Aspire.GoFeatureFlag

Registers a [GoFeatureFlagProvider](https://github.com/open-feature/dotnet-sdk-contrib/tree/main/src/OpenFeature.Contrib.Providers.GOFeatureFlag) in the DI container for connecting to a GO Feature Flag instance.
Registers a [GoFeatureFlagProvider](https://github.com/open-feature/dotnet-sdk-contrib/tree/main/src/OpenFeature.Providers.GOFeatureFlag) in the DI container for connecting to a GO Feature Flag instance.

## Getting started

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public sealed partial class GoFeatureFlagClientSettings

public int? HealthCheckTimeout { get { throw null; } set { } }

public OpenFeature.Contrib.Providers.GOFeatureFlag.GoFeatureFlagProviderOptions ProviderOptions { get { throw null; } set { } }
public OpenFeature.Providers.GOFeatureFlag.GoFeatureFlagProviderOptions ProviderOptions { get { throw null; } set { } }
}
}

Expand All @@ -28,4 +28,4 @@ public static void AddGoFeatureFlagClient(this IHostApplicationBuilder builder,

public static void AddKeyedGoFeatureFlagClient(this IHostApplicationBuilder builder, string name, System.Action<CommunityToolkit.Aspire.GoFeatureFlag.GoFeatureFlagClientSettings>? configureSettings = null) { }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ internal static class GoFeatureFlagContainerImageTags
public const string Registry = "docker.io";
/// <summary>gofeatureflag/go-feature-flag</summary>
public const string Image = "gofeatureflag/go-feature-flag";
/// <summary>v1.41</summary>
public const string Tag = "v1.41";
/// <summary>v1.50</summary>
public const string Tag = "v1.50";
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Hosting;
using OpenFeature.Contrib.Providers.GOFeatureFlag;
using OpenFeature.Providers.GOFeatureFlag;

namespace CommunityToolkit.Aspire.GoFeatureFlag.Tests;

Expand Down Expand Up @@ -97,9 +97,9 @@ public void CanAddMultipleKeyedServices()

using var host = builder.Build();

var client1 = host.Services.GetRequiredService<GoFeatureFlagProvider>();
var client2 = host.Services.GetRequiredKeyedService<GoFeatureFlagProvider>("goff2");
var client3 = host.Services.GetRequiredKeyedService<GoFeatureFlagProvider>("goff3");
var client1 = host.Services.GetRequiredService<GOFeatureFlagProvider>();
var client2 = host.Services.GetRequiredKeyedService<GOFeatureFlagProvider>("goff2");
var client3 = host.Services.GetRequiredKeyedService<GOFeatureFlagProvider>("goff3");

Assert.NotSame(client1, client2);
Assert.NotSame(client1, client3);
Expand All @@ -121,8 +121,8 @@ public void CanAddClientFromEncodedConnectionString()

using var host = builder.Build();

var client1 = host.Services.GetRequiredService<GoFeatureFlagProvider>();
var client2 = host.Services.GetRequiredKeyedService<GoFeatureFlagProvider>("goff2");
var client1 = host.Services.GetRequiredService<GOFeatureFlagProvider>();
var client2 = host.Services.GetRequiredKeyedService<GOFeatureFlagProvider>("goff2");

Assert.NotSame(client1, client2);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
using Aspire.Components.ConformanceTests;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using OpenFeature.Contrib.Providers.GOFeatureFlag;
using OpenFeature.Providers.GOFeatureFlag;
using OpenFeature.Model;

namespace CommunityToolkit.Aspire.GoFeatureFlag.Tests;

public class ConformanceTests : ConformanceTests<GoFeatureFlagProvider, GoFeatureFlagClientSettings>, IClassFixture<GoFeatureFlagContainerFixture>
public class ConformanceTests : ConformanceTests<GOFeatureFlagProvider, GoFeatureFlagClientSettings>, IClassFixture<GoFeatureFlagContainerFixture>
{
private readonly GoFeatureFlagContainerFixture _containerFixture;

Expand Down Expand Up @@ -102,7 +102,7 @@ protected override void SetTracing(GoFeatureFlagClientSettings options, bool ena
throw new NotImplementedException();
}

protected override void TriggerActivity(GoFeatureFlagProvider service)
protected override void TriggerActivity(GOFeatureFlagProvider service)
{
using var source = new CancellationTokenSource(100);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Microsoft.Extensions.Hosting;
using Xunit.Abstractions;
using Aspire.Hosting.Utils;
using OpenFeature.Contrib.Providers.GOFeatureFlag;
using OpenFeature.Providers.GOFeatureFlag;
using OpenFeature.Model;

namespace CommunityToolkit.Aspire.Hosting.GoFeatureFlag.Tests;
Expand All @@ -16,7 +16,7 @@ namespace CommunityToolkit.Aspire.Hosting.GoFeatureFlag.Tests;
public class GoFeatureFlagFunctionalTests(ITestOutputHelper testOutputHelper)
{
private static readonly string SOURCE = Path.GetFullPath("./goff", Directory.GetCurrentDirectory());

[Fact]
public async Task VerifyGoFeatureFlagResource()
{
Expand All @@ -32,7 +32,7 @@ public async Task VerifyGoFeatureFlagResource()
var rns = app.Services.GetRequiredService<ResourceNotificationService>();

await rns.WaitForResourceHealthyAsync(goff.Resource.Name);

var hb = Host.CreateApplicationBuilder();

hb.Configuration[$"ConnectionStrings:{goff.Resource.Name}"] = await goff.Resource.ConnectionStringExpression.GetValueAsync(default);
Expand All @@ -43,7 +43,7 @@ public async Task VerifyGoFeatureFlagResource()

await host.StartAsync();

var goFeatureFlagProvider = host.Services.GetRequiredService<GoFeatureFlagProvider>();
var goFeatureFlagProvider = host.Services.GetRequiredService<GOFeatureFlagProvider>();

await VerifyTestData(goFeatureFlagProvider);
}
Expand Down Expand Up @@ -89,7 +89,7 @@ public async Task VerifyWaitForOnGoFeatureFlagBlocksDependentResources()
await app.StopAsync();
}

private static async Task VerifyTestData(GoFeatureFlagProvider goFeatureFlagProvider)
private static async Task VerifyTestData(GOFeatureFlagProvider goFeatureFlagProvider)
{
var userContext = EvaluationContext.Builder()
.Set("targetingKey", Guid.NewGuid().ToString())
Expand All @@ -103,4 +103,4 @@ private static async Task VerifyTestData(GoFeatureFlagProvider goFeatureFlagProv
Assert.NotNull(flag);
Assert.True(flag.Value);
}
}
}
Loading