GoFeatureFlagBuilderExtensions Methods
ClassMethods4 members
Provides extension methods for adding GO Feature Flag resources to the application model.
AddGoFeatureFlag(IDistributedApplicationBuilder, string, string?, int?) Section titled AddGoFeatureFlag(IDistributedApplicationBuilder, string, string?, int?)extensionIResourceBuilder<GoFeatureFlagResource> Adds an GO Feature Flag container resource to the application model. The default image is and the tag is .
public static class GoFeatureFlagBuilderExtensions{ public static IResourceBuilder<GoFeatureFlagResource> AddGoFeatureFlag( this IDistributedApplicationBuilder builder, string name, string? pathToConfigFile = null, int? port = null) { // ... }}Parameters
builderIDistributedApplicationBuilder The Hosting.IDistributedApplicationBuilder .namestringThe name of the resource. This name will be used as the connection string name when referenced in a dependency.pathToConfigFile string?optionalThe path set to find the configuration file (https://gofeatureflag.org/docs/relay-proxy/configure-relay-proxy#configuration-file).portint?optionalThe host port to bind the underlying container to.Returns
IResourceBuilder<GoFeatureFlagResource> A reference to the ApplicationModel.IResourceBuilder`1 .Remarks
Add an GO Feature Flag container to the application model and reference it in a .NET project.
var builder = DistributedApplication.CreateBuilder(args);
var goff = builder.AddGoFeatureFlag("goff");var api = builder.AddProject<Projects.Api>("api") .WithReference(goff);
builder.Build().Run();WithDataVolume(IResourceBuilder<GoFeatureFlagResource>, string?) Section titled WithDataVolume(IResourceBuilder<GoFeatureFlagResource>, string?)extensionIResourceBuilder<GoFeatureFlagResource> Adds a named volume for the data folder to a GO Feature flag container resource.
public static class GoFeatureFlagBuilderExtensions{ public static IResourceBuilder<GoFeatureFlagResource> WithDataVolume( this IResourceBuilder<GoFeatureFlagResource> builder, string? name = null) { // ... }}Parameters
builderIResourceBuilder<GoFeatureFlagResource> The resource builder.namestring?optionalThe name of the volume. Defaults to an auto-generated name based on the application and resource names.Returns
IResourceBuilder<GoFeatureFlagResource> The ApplicationModel.IResourceBuilder`1 .Remarks
Add a GO Feature flag container to the application model and reference it in a .NET project. Additionally, in this example a data volume is added to the container to allow data to be persisted across container restarts.
var builder = DistributedApplication.CreateBuilder(args);
var goff = builder.AddGoFeatureFlag("goff").WithDataVolume();var api = builder.AddProject<Projects.Api>("api") .WithReference(goff);
builder.Build().Run();WithGoffBindMount(IResourceBuilder<GoFeatureFlagResource>, string) Section titled WithGoffBindMount(IResourceBuilder<GoFeatureFlagResource>, string)extensionIResourceBuilder<GoFeatureFlagResource> Adds a bind mount for the goff configuration folder to a GO Feature flag container resource.
public static class GoFeatureFlagBuilderExtensions{ public static IResourceBuilder<GoFeatureFlagResource> WithGoffBindMount( this IResourceBuilder<GoFeatureFlagResource> builder, string source) { // ... }}Parameters
builderIResourceBuilder<GoFeatureFlagResource> The resource builder.sourcestringThe source directory on the host to mount into the container.Returns
IResourceBuilder<GoFeatureFlagResource> The ApplicationModel.IResourceBuilder`1 .Remarks
Add a GO Feature flag container to the application model and reference it in a .NET project. Additionally, in this example a bind mount is added to the container to allow reading goff configuration.
var builder = DistributedApplication.CreateBuilder(args);
var goff = builder.AddGoFeatureFlag("goff").WithGoffBindMount("./goff");var api = builder.AddProject<Projects.Api>("api") .WithReference(goff);
builder.Build().Run();WithLogLevel(IResourceBuilder<GoFeatureFlagResource>, LogLevel) Section titled WithLogLevel(IResourceBuilder<GoFeatureFlagResource>, LogLevel)extensionIResourceBuilder<GoFeatureFlagResource> Configures logging level for the GO Feature Flag container resource.
public static class GoFeatureFlagBuilderExtensions{ public static IResourceBuilder<GoFeatureFlagResource> WithLogLevel( this IResourceBuilder<GoFeatureFlagResource> builder, LogLevel logLevel) { // ... }}Parameters
builderIResourceBuilder<GoFeatureFlagResource> The resource builder.logLevel LogLevel The log level to set.Returns
IResourceBuilder<GoFeatureFlagResource> The ApplicationModel.IResourceBuilder`1 .Remarks
The only supported
Logging.LogLevel by GO Feature Flag are LogLevel.Error , LogLevel.Warning , LogLevel.Information and LogLevel.Debug . This overload is not available in polyglot AppHosts. Use the enum-based overload instead.