Skip to content
DocsTry Aspire
DocsTry

FlagdBuilderExtensions Methods

ClassMethods3 members
Provides extension methods for adding flagd resources to an Hosting.IDistributedApplicationBuilder.
AddFlagd(IDistributedApplicationBuilder, string, int?, int?)Section titled AddFlagd(IDistributedApplicationBuilder, string, int?, int?)extensionIResourceBuilder<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)
{
// ...
}
}
builderIDistributedApplicationBuilderThe Hosting.IDistributedApplicationBuilder.
namestringThe name of the resource. This name will be used as the connection string name when referenced in a dependency.
portint?optionalThe host port for flagd HTTP endpoint. If not provided, a random port will be assigned.
ofrepPortint?optionalThe 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)extensionIResourceBuilder<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")
{
// ...
}
}
builderIResourceBuilder<FlagdResource>The resource builder.
fileSourcestringThe path to the host directory that contains the flag configuration file.
filenamestringoptionalThe 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)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<FlagdResource>The resource builder.
logLevelLogLevelThe log level to use. Currently only debug is supported.
IResourceBuilder<FlagdResource>The ApplicationModel.IResourceBuilder`1.
InvalidOperationExceptionThrown if the log level is not valid.
Currently only debug is supported. This method is not available in polyglot app hosts. Configure the FLAGD_DEBUG environment variable directly instead.