# LogtoResource.WithDatabase

- Module: [CommunityToolkit.Aspire.Hosting.Logto](/reference/api/go/communitytoolkit.aspire.hosting.logto.md)
- Defined on: [LogtoResource](/reference/api/go/communitytoolkit.aspire.hosting.logto/logtoresource.md)
- Version: `13.6.1`
- Kind: `method`

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

## Definition

```go
type LogtoResource interface {
    // ... omitted for brevity
    WithDatabase(
        postgres PostgresServerResource,
        options ...*WithDatabaseOptions,
    ) LogtoResource
}
```

## Signature

```go
WithDatabase(
    postgres PostgresServerResource,
    options ...*WithDatabaseOptions,
) LogtoResource
```

## Parameters

- `postgres` ([`PostgresServerResource`](/reference/api/go/communitytoolkit.aspire.hosting.logto/postgresserverresource.md)) -- The resource builder for the PostgreSQL server to connect to.
- `options` (`...*WithDatabaseOptions`) -- optional settings, see [Options](#options)

## Options

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

- `DatabaseName` (`*string`) -- The PostgreSQL database name Logto should use.

## Returns

[`LogtoResource`](/reference/api/go/communitytoolkit.aspire.hosting.logto/logtoresource.md) -- The resource builder for the configured Logto resource.

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

## Defined on

- [LogtoResource](/reference/api/go/communitytoolkit.aspire.hosting.logto/logtoresource.md) -- `handle`
