GO Feature Flag Hosting integration reference
यह कंटेंट अभी तक आपकी भाषा में उपलब्ध नहीं है।
To get started with the Aspire GO Feature Flag integrations, follow the Get started with GO Feature Flag integrations guide.
This article includes full details about the Aspire GO Feature Flag Hosting integration.
Installation
Section titled “Installation”To access the types and APIs for expressing GO Feature Flag as a resource in your AppHost project, install the 📦 CommunityToolkit.Aspire.Hosting.GoFeatureFlag NuGet package:
aspire add communitytoolkit-gofeatureflagAspire CLI इंटरैक्टिव है; प्रॉम्प्ट पर उपयुक्त परिणाम चुनें:
Select an integration to add:
> communitytoolkit-gofeatureflag (CommunityToolkit.Aspire.Hosting.GoFeatureFlag)> Other results listed as selectable options...#:package CommunityToolkit.Aspire.Hosting.GoFeatureFlag@*<PackageReference Include="CommunityToolkit.Aspire.Hosting.GoFeatureFlag" Version="*" />Add goff server resource
Section titled “Add goff server resource”In your app host project, call AddGoFeatureFlag on the builder instance to add a goff container resource:
var builder = DistributedApplication.CreateBuilder(args);
var goff = builder.AddGoFeatureFlag("goff") .WithGoffBindMount("./goff");
builder.AddProject<Projects.ExampleProject>() .WithReference(goff);
// After adding all resources, run the app...When Aspire adds a container image to the app host, as shown in the preceding example with the docker.io/gofeatureflag/go-feature-flag image, it creates a new goff server instance on your local machine. A reference to your goff server (the goff variable) is added to the ExampleProject.
Flag configuration format
Section titled “Flag configuration format”goff uses either the YAML, JSON or TOML format to configure feature flags. Here is a simple example for you to get started:
display-banner: variations: enabled: true disabled: false defaultRule: variation: enabledYou can learn more on how to create flags here: Create flags with goff.
Flag configuration
Section titled “Flag configuration”In the previous section, we created flags via a configuration file. We now need another file to configure the Relay Proxy that will load your flags from the file system. Here is what you need to ingest the previous created file:
retrievers: - kind: file path: /goff/flags.yamlConfigure logging
Section titled “Configure logging”To configure debug logging for the goff container resource, call the WithLogLevel method:
var builder = DistributedApplication.CreateBuilder(args);
var goff = builder.AddGoFeatureFlag("goff") .WithGoffBindMount("./goff") .WithLogLevel(Microsoft.Extensions.Logging.LogLevel.Debug);
builder.AddProject<Projects.ExampleProject>() .WithReference(goff);
// After adding all resources, run the app...The WithLogLevel method enables debug logging in the goff container, which provides verbose output for troubleshooting flag evaluation issues. Currently, only Debug, Information, Warning and Error log levels are supported.
Customize ports
Section titled “Customize ports”To customize the port used by the goff container resource, provide the port parameter to the AddGoFeatureFlag method:
var builder = DistributedApplication.CreateBuilder(args);
var goff = builder.AddGoFeatureFlag(name: "goff", port: 1031) .WithGoffBindMount("./goff");
builder.AddProject<Projects.ExampleProject>() .WithReference(goff);
// After adding all resources, run the app...The port parameter specifies the host port for the goff HTTP endpoint. If this parameter is not provided, a random port is assigned.
Health checks
Section titled “Health checks”The goff hosting integration automatically adds a health check for the goff server resource. The health check verifies that the goff server is running and that a connection can be established to it.
The hosting integration uses the goff /health endpoint to perform health checks.