Skip to content
Docs Try Aspire

FlagdBuilderExtensions Methods

Class Methods 3 members
Provides extension methods for adding flagd resources to an Hosting.IDistributedApplicationBuilder.
AddFlagd(IDistributedApplicationBuilder, string, int?, int?) Section titled AddFlagd(IDistributedApplicationBuilder, string, int?, int?) extension IResourceBuilder<FlagdResource>
Adds a flagd container to the application model.
public static class FlagdBuilderExtensions
{
public static IResourceBuilder<FlagdResource> AddFlagd(
this IDistributedApplicationBuilder builder,
string name,
int? port = null,
int? ofrepPort = null)
{
// ...
}
}
builder IDistributedApplicationBuilder The Hosting.IDistributedApplicationBuilder.
name string The name of the resource. This name will be used as the connection string name when referenced in a dependency.
port int? optional The host port for flagd HTTP endpoint. If not provided, a random port will be assigned.
ofrepPort int? optional The host port for flagd OFREP endpoint. If not provided, a random port will be assigned.
IResourceBuilder<FlagdResource> A reference to the ApplicationModel.IResourceBuilder`1.
The flagd container requires a sync source to be configured.
WithBindFileSync(IResourceBuilder<FlagdResource>, string, string) Section titled WithBindFileSync(IResourceBuilder<FlagdResource>, string, string) extension IResourceBuilder<FlagdResource>
Configures flagd to use a bind mount as the source of flags.
public static class FlagdBuilderExtensions
{
public static IResourceBuilder<FlagdResource> WithBindFileSync(
this IResourceBuilder<FlagdResource> builder,
string fileSource,
string filename = "flagd.json")
{
// ...
}
}
builder IResourceBuilder<FlagdResource> The resource builder.
fileSource string The path to the flag configuration file on the host.
filename string optional The name of the flag configuration file. Defaults to "flagd.json".
IResourceBuilder<FlagdResource> The ApplicationModel.IResourceBuilder`1.
WithLogLevel(IResourceBuilder<FlagdResource>, LogLevel) Section titled WithLogLevel(IResourceBuilder<FlagdResource>, LogLevel) extension IResourceBuilder<FlagdResource>
Configures logging level for flagd. If a flag or targeting rule isn't proceeding the way you'd expect this can be enabled to get more verbose logging.
public static class FlagdBuilderExtensions
{
public static IResourceBuilder<FlagdResource> WithLogLevel(
this IResourceBuilder<FlagdResource> builder,
LogLevel logLevel)
{
// ...
}
}
builder IResourceBuilder<FlagdResource> The resource builder.
logLevel LogLevel The log level to use. Currently only debug is supported.
IResourceBuilder<FlagdResource> The ApplicationModel.IResourceBuilder`1.
InvalidOperationException Thrown if the log level is not valid.
Currently only debug is supported.