# LogtoBuilderExtensions Methods

- Package: [CommunityToolkit.Aspire.Hosting.Logto](/reference/api/csharp/communitytoolkit.aspire.hosting.logto.md)
- Type: [LogtoBuilderExtensions](/reference/api/csharp/communitytoolkit.aspire.hosting.logto/logtobuilderextensions.md)
- Kind: `Methods`
- Members: `14`

Provides extension methods for configuring and managing Logto resources within the Aspire hosting application framework.

<a id="addlogto"></a>
<a id="addlogto-idistributedapplicationbuilder-string-iresourcebuilder-postgresserverresource-string-int-int"></a>

## AddLogto(IDistributedApplicationBuilder, string, IResourceBuilder<PostgresServerResource>, string, int?, int?)

- Name: `AddLogto(IDistributedApplicationBuilder, string, IResourceBuilder<PostgresServerResource>, string, int?, int?)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<LogtoResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.Logto/LogtoBuilderExtensions.cs#L34-L50)

Adds a Logto resource to the Aspire distributed application by configuring it with the specified name, associated PostgreSQL server resource, and database name.

```csharp
public static class LogtoBuilderExtensions
{
    public static IResourceBuilder<LogtoResource> AddLogto(
        this IDistributedApplicationBuilder builder,
        string name,
        IResourceBuilder<PostgresServerResource> postgres,
        string databaseName = "logto_db",
        int? port = null,
        int? adminPort = null)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IDistributedApplicationBuilder`)
  The distributed application builder to which the Logto resource will be added.
- `name` (`string`)
  The name of the Logto resource.
- `postgres` (`IResourceBuilder<PostgresServerResource>`)
  The resource builder for the PostgreSQL server that the Logto will connect to.
- `databaseName` (`string`) `optional`
  The PostgreSQL database name Logto should use.
- `port` (`int?`) `optional`
  The host port to be configured for the primary endpoint. If `null`, Aspire will assign a random host port.
- `adminPort` (`int?`) `optional`
  The host port to be configured for the administrative endpoint. If `null`, Aspire will assign a random host port.

## Returns

`IResourceBuilder<LogtoResource>` -- The resource builder configured for the added Logto resource.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

<a id="withadminendpoint"></a>
<a id="withadminendpoint-iresourcebuilder-logtoresource-string"></a>

## WithAdminEndpoint(IResourceBuilder<LogtoResource>, string)

- Name: `WithAdminEndpoint(IResourceBuilder<LogtoResource>, string)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<LogtoResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.Logto/LogtoBuilderExtensions.cs#L147-L150)

Configures the specified Logto resource to include an administrative endpoint with the given URL.

```csharp
public static class LogtoBuilderExtensions
{
    public static IResourceBuilder<LogtoResource> WithAdminEndpoint(
        this IResourceBuilder<LogtoResource> builder,
        string url)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<LogtoResource>`)
  The resource builder for the Logto resource to configure.
- `url` (`string`)
  The URL of the administrative endpoint to be used for the Logto resource.

## Returns

`IResourceBuilder<LogtoResource>` -- The resource builder for the configured Logto resource.

## Examples

```csharp
https://admin.domain.com
```

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

<a id="withdatabase"></a>
<a id="withdatabase-iresourcebuilder-logtoresource-iresourcebuilder-postgresserverresource-string"></a>

## WithDatabase(IResourceBuilder<LogtoResource>, IResourceBuilder<PostgresServerResource>, string)

- Name: `WithDatabase(IResourceBuilder<LogtoResource>, IResourceBuilder<PostgresServerResource>, string)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<LogtoResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.Logto/LogtoBuilderExtensions.cs#L254-L263)

Configures the Logto resource to connect to the specified PostgreSQL database.

```csharp
public static class LogtoBuilderExtensions
{
    public static IResourceBuilder<LogtoResource> WithDatabase(
        this IResourceBuilder<LogtoResource> builder,
        IResourceBuilder<PostgresServerResource> postgres,
        string databaseName = "logto_db")
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<LogtoResource>`)
  The resource builder for the Logto resource to configure.
- `postgres` (`IResourceBuilder<PostgresServerResource>`)
  The resource builder for the PostgreSQL server to connect to.
- `databaseName` (`string`) `optional`
  The PostgreSQL database name Logto should use.

## Returns

`IResourceBuilder<LogtoResource>` -- The resource builder for the configured Logto resource.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

<a id="withdatabaseseeding"></a>
<a id="withdatabaseseeding-iresourcebuilder-logtoresource"></a>

## WithDatabaseSeeding(IResourceBuilder<LogtoResource>)

- Name: `WithDatabaseSeeding(IResourceBuilder<LogtoResource>)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<LogtoResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.Logto/LogtoBuilderExtensions.cs#L274-L278)

Starts Logto by running the database seed command before the application process.

```csharp
public static class LogtoBuilderExtensions
{
    public static IResourceBuilder<LogtoResource> WithDatabaseSeeding(
        this IResourceBuilder<LogtoResource> builder)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<LogtoResource>`)
  The resource builder for the Logto resource to configure.

## Returns

`IResourceBuilder<LogtoResource>` -- The resource builder for the configured Logto resource.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

<a id="withdatabindmount"></a>
<a id="withdatabindmount-iresourcebuilder-logtoresource-string"></a>

## WithDataBindMount(IResourceBuilder<LogtoResource>, string)

- Name: `WithDataBindMount(IResourceBuilder<LogtoResource>, string)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<LogtoResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.Logto/LogtoBuilderExtensions.cs#L219-L222)

Configures the Logto resource to use a data bind mount with the specified source directory.

```csharp
public static class LogtoBuilderExtensions
{
    public static IResourceBuilder<LogtoResource> WithDataBindMount(
        this IResourceBuilder<LogtoResource> builder,
        string source)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<LogtoResource>`)
  The resource builder for the Logto resource to configure.
- `source` (`string`)
  The host directory to be mounted as the data volume.

## Returns

`IResourceBuilder<LogtoResource>` -- The resource builder for the configured Logto resource.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

<a id="withdatavolume"></a>
<a id="withdatavolume-iresourcebuilder-logtoresource-string"></a>

## WithDataVolume(IResourceBuilder<LogtoResource>, string?)

- Name: `WithDataVolume(IResourceBuilder<LogtoResource>, string?)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<LogtoResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.Logto/LogtoBuilderExtensions.cs#L107-L109)

Configures the Logto resource with a data volume, allowing persistent storage.

```csharp
public static class LogtoBuilderExtensions
{
    public static IResourceBuilder<LogtoResource> WithDataVolume(
        this IResourceBuilder<LogtoResource> builder,
        string? name = null)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<LogtoResource>`)
  The resource builder for the Logto resource to configure.
- `name` (`string?`) `optional`
  The optional name of the data volume. If not provided, a default name is generated.

## Returns

`IResourceBuilder<LogtoResource>` -- The resource builder configured with the specified data volume.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

<a id="withdeprecationtracing"></a>
<a id="withdeprecationtracing-iresourcebuilder-logtoresource"></a>

## WithDeprecationTracing(IResourceBuilder<LogtoResource>)

- Name: `WithDeprecationTracing(IResourceBuilder<LogtoResource>)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<LogtoResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.Logto/LogtoBuilderExtensions.cs#L63-L65)

Enables Node.js deprecation tracing for the Logto by setting the NODE_OPTIONS environment variable to '--trace-deprecation'. This allows stack traces to be printed for deprecated API usage.

```csharp
public static class LogtoBuilderExtensions
{
    public static IResourceBuilder<LogtoResource> WithDeprecationTracing(
        this IResourceBuilder<LogtoResource> builderWithResource)
    {
        // ...
    }
}
```

## Parameters

- `builderWithResource` (`IResourceBuilder<LogtoResource>`)
  The resource builder for the Logto resource that will be configured for stack trace logging.

## Returns

`IResourceBuilder<LogtoResource>` -- The resource builder for the configured Logto resource.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

<a id="withdisableadminconsole"></a>
<a id="withdisableadminconsole-iresourcebuilder-logtoresource-bool"></a>

## WithDisableAdminConsole(IResourceBuilder<LogtoResource>, bool)

- Name: `WithDisableAdminConsole(IResourceBuilder<LogtoResource>, bool)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<LogtoResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.Logto/LogtoBuilderExtensions.cs#L162-L164)

Configures the Logto resource to disable the Admin Console port.

```csharp
public static class LogtoBuilderExtensions
{
    public static IResourceBuilder<LogtoResource> WithDisableAdminConsole(
        this IResourceBuilder<LogtoResource> builder,
        bool disable)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<LogtoResource>`)
  The resource builder for the Logto resource to configure.
- `disable` (`bool`)
  A value indicating whether to disable the Admin Console port.

## Returns

`IResourceBuilder<LogtoResource>` -- The resource builder for the configured Logto resource.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

<a id="withnodeenv"></a>
<a id="withnodeenv-iresourcebuilder-logtoresource-string"></a>

## WithNodeEnv(IResourceBuilder<LogtoResource>, string)

- Name: `WithNodeEnv(IResourceBuilder<LogtoResource>, string)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<LogtoResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.Logto/LogtoBuilderExtensions.cs#L92-L95)

Configures the Logto resource to use the specified Node.js environment value by setting the corresponding environment variable.

```csharp
public static class LogtoBuilderExtensions
{
    public static IResourceBuilder<LogtoResource> WithNodeEnv(
        this IResourceBuilder<LogtoResource> builder,
        string env)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<LogtoResource>`)
  The resource builder for the Logto resource to configure.
- `env` (`string`)
  The value of the Node.js environment variable to set, typically "development", "production", or "test".

## Returns

`IResourceBuilder<LogtoResource>` -- The resource builder for the configured Logto resource.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

<a id="withredis"></a>
<a id="withredis-iresourcebuilder-logtoresource-iresourcebuilder-redisresource"></a>

## WithRedis(IResourceBuilder<LogtoResource>, IResourceBuilder<RedisResource>)

- Name: `WithRedis(IResourceBuilder<LogtoResource>, IResourceBuilder<RedisResource>)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<LogtoResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.Logto/LogtoBuilderExtensions.cs#L234-L238)

Configures the Logto resource to use a specified Redis resource for caching or other functionality.

```csharp
public static class LogtoBuilderExtensions
{
    public static IResourceBuilder<LogtoResource> WithRedis(
        this IResourceBuilder<LogtoResource> builder,
        IResourceBuilder<RedisResource> redis)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<LogtoResource>`)
  The resource builder for the Logto resource to configure.
- `redis` (`IResourceBuilder<RedisResource>`)
  The resource builder for the Redis resource to be used by the Logto resource.

## Returns

`IResourceBuilder<LogtoResource>` -- The resource builder configured with the specified Redis resource.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

<a id="withresourceport"></a>
<a id="withresourceport-iresourcebuilder-logtoresource-int-int"></a>

## WithResourcePort(IResourceBuilder<LogtoResource>, int?, int?)

- Name: `WithResourcePort(IResourceBuilder<LogtoResource>, int?, int?)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<LogtoResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.Logto/LogtoBuilderExtensions.cs#L125-L134)

Configures HTTP endpoints for the given Logto resource builder with specified port settings.

```csharp
public static class LogtoBuilderExtensions
{
    public static IResourceBuilder<LogtoResource> WithResourcePort(
        this IResourceBuilder<LogtoResource> builder,
        int? port = null,
        int? adminPort = null)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<LogtoResource>`)
  The resource builder for the Logto resource to configure.
- `port` (`int?`) `optional`
  The host port to be configured for the primary endpoint. If `null`, Aspire will assign a random host port.
- `adminPort` (`int?`) `optional`
  The host port to be configured for the administrative endpoint. If `null`, Aspire will assign a random host port.

## Returns

`IResourceBuilder<LogtoResource>` -- The updated resource builder with the configured HTTP endpoints.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

<a id="withsecretvault"></a>
<a id="withsecretvault-iresourcebuilder-logtoresource-string"></a>

## WithSecretVault(IResourceBuilder<LogtoResource>, string)

- Name: `WithSecretVault(IResourceBuilder<LogtoResource>, string)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<LogtoResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.Logto/LogtoBuilderExtensions.cs#L204-L207)

Configures the Logto resource to use a secret vault with the specified key encryption key (KEK).

```csharp
public static class LogtoBuilderExtensions
{
    public static IResourceBuilder<LogtoResource> WithSecretVault(
        this IResourceBuilder<LogtoResource> builder,
        string secretVaultKek)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<LogtoResource>`)
  The resource builder for the Logto resource to configure.
- `secretVaultKek` (`string`)
  The base64-encoded key encryption key (KEK) for the secret vault.

## Returns

`IResourceBuilder<LogtoResource>` -- The resource builder for the configured Logto resource.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

<a id="withsensitiveusername"></a>
<a id="withsensitiveusername-iresourcebuilder-logtoresource-bool"></a>

## WithSensitiveUsername(IResourceBuilder<LogtoResource>, bool)

- Name: `WithSensitiveUsername(IResourceBuilder<LogtoResource>, bool)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<LogtoResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.Logto/LogtoBuilderExtensions.cs#L190-L192)

Specifies whether the username is case-sensitive.

```csharp
public static class LogtoBuilderExtensions
{
    public static IResourceBuilder<LogtoResource> WithSensitiveUsername(
        this IResourceBuilder<LogtoResource> builder,
        bool sensitiveUsername)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<LogtoResource>`)
  The resource builder for the Logto resource to configure.
- `sensitiveUsername` (`bool`)
  A value indicating whether usernames should be treated as case-sensitive.

## Returns

`IResourceBuilder<LogtoResource>` -- The updated resource builder with the configured case-sensitivity setting.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.

<a id="withtrustproxyheader"></a>
<a id="withtrustproxyheader-iresourcebuilder-logtoresource-bool"></a>

## WithTrustProxyHeader(IResourceBuilder<LogtoResource>, bool)

- Name: `WithTrustProxyHeader(IResourceBuilder<LogtoResource>, bool)`
- Modifiers: `extension`
- Returns: `IResourceBuilder<LogtoResource>`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d479e13473b1d29d06b974f144a0049289a3cb5c/src/CommunityToolkit.Aspire.Hosting.Logto/LogtoBuilderExtensions.cs#L176-L178)

Configures the Logto resource to enable or disable the trust proxy header behavior.

```csharp
public static class LogtoBuilderExtensions
{
    public static IResourceBuilder<LogtoResource> WithTrustProxyHeader(
        this IResourceBuilder<LogtoResource> builder,
        bool trustProxyHeader)
    {
        // ...
    }
}
```

## Parameters

- `builder` (`IResourceBuilder<LogtoResource>`)
  The resource builder for the Logto resource to configure.
- `trustProxyHeader` (`bool`)
  A value indicating whether to trust the proxy header.

## Returns

`IResourceBuilder<LogtoResource>` -- The resource builder for the configured Logto resource.

## ATS metadata

### ATS export

- Available to Polyglot AppHosts through the Aspire Type System.
