# AddFlagd

- Module: [CommunityToolkit.Aspire.Hosting.Flagd](/reference/api/go/communitytoolkit.aspire.hosting.flagd.md)
- Version: `13.6.1`
- Kind: `method`
- Defined on: `DistributedApplicationBuilder`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/tree/d9c2addac6f527ef2e33712d290b84574b455a3b)

Adds a flagd container to the application model.

## Remarks

The flagd container requires a sync source to be configured.

## Definition

```go
func (DistributedApplicationBuilder) AddFlagd(
    name string,
    options ...*AddFlagdOptions,
) FlagdResource
```

## Parameters

- `name` (`string`) -- The name of the resource. This name will be used as the connection string name when referenced in a dependency.
- `options` (`...*AddFlagdOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*AddFlagdOptions` argument.

- `Port` (`*float64`) -- The host port for flagd HTTP endpoint. If not provided, a random port will be assigned.
- `OfrepPort` (`*float64`) -- The host port for flagd OFREP endpoint. If not provided, a random port will be assigned.

## Returns

[`FlagdResource`](/reference/api/go/communitytoolkit.aspire.hosting.flagd/flagdresource.md) -- A reference to the `IResourceBuilder`.

Returns a handle; failures surface later via `Err()`.

## Applies to

- `DistributedApplicationBuilder`
