LogtoBuilderExtensions Methods
ClassMethods14 members
Provides extension methods for configuring and managing Logto resources within the Aspire hosting application framework.
AddLogto(IDistributedApplicationBuilder, string, IResourceBuilder<PostgresServerResource>, string, int?, int?)Section titled AddLogto(IDistributedApplicationBuilder, string, IResourceBuilder<PostgresServerResource>, string, int?, int?)extensionIResourceBuilder<LogtoResource> Adds a Logto resource to the Aspire distributed application by configuring it with the specified name, associated PostgreSQL server resource, and database name.
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
builderIDistributedApplicationBuilderThe distributed application builder to which the Logto resource will be added.namestringThe name of the Logto resource.postgresIResourceBuilder<PostgresServerResource>The resource builder for the PostgreSQL server that the Logto will connect to.databaseNamestringoptionalThe PostgreSQL database name Logto should use.portint?optionalThe host port to be configured for the primary endpoint. If null, Aspire will assign a random host port.adminPortint?optionalThe 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.WithAdminEndpoint(IResourceBuilder<LogtoResource>, string)Section titled WithAdminEndpoint(IResourceBuilder<LogtoResource>, string)extensionIResourceBuilder<LogtoResource> Configures the specified Logto resource to include an administrative endpoint with the given URL.
public static class LogtoBuilderExtensions{ public static IResourceBuilder<LogtoResource> WithAdminEndpoint( this IResourceBuilder<LogtoResource> builder, string url) { // ... }}Parameters
builderIResourceBuilder<LogtoResource>The resource builder for the Logto resource to configure.urlstringThe URL of the administrative endpoint to be used for the Logto resource.Returns
IResourceBuilder<LogtoResource>The resource builder for the configured Logto resource.Examples
https://admin.domain.comWithDatabase(IResourceBuilder<LogtoResource>, IResourceBuilder<PostgresServerResource>, string)Section titled WithDatabase(IResourceBuilder<LogtoResource>, IResourceBuilder<PostgresServerResource>, string)extensionIResourceBuilder<LogtoResource> Configures the Logto resource to connect to the specified PostgreSQL database.
public static class LogtoBuilderExtensions{ public static IResourceBuilder<LogtoResource> WithDatabase( this IResourceBuilder<LogtoResource> builder, IResourceBuilder<PostgresServerResource> postgres, string databaseName = "logto_db") { // ... }}Parameters
builderIResourceBuilder<LogtoResource>The resource builder for the Logto resource to configure.postgresIResourceBuilder<PostgresServerResource>The resource builder for the PostgreSQL server to connect to.databaseNamestringoptionalThe PostgreSQL database name Logto should use.Returns
IResourceBuilder<LogtoResource>The resource builder for the configured Logto resource.WithDatabaseSeeding(IResourceBuilder<LogtoResource>)Section titled WithDatabaseSeeding(IResourceBuilder<LogtoResource>)extensionIResourceBuilder<LogtoResource> Starts Logto by running the database seed command before the application process.
public static class LogtoBuilderExtensions{ public static IResourceBuilder<LogtoResource> WithDatabaseSeeding( this IResourceBuilder<LogtoResource> builder) { // ... }}Parameters
builderIResourceBuilder<LogtoResource>The resource builder for the Logto resource to configure.Returns
IResourceBuilder<LogtoResource>The resource builder for the configured Logto resource.WithDataBindMount(IResourceBuilder<LogtoResource>, string)Section titled WithDataBindMount(IResourceBuilder<LogtoResource>, string)extensionIResourceBuilder<LogtoResource> Configures the Logto resource to use a data bind mount with the specified source directory.
public static class LogtoBuilderExtensions{ public static IResourceBuilder<LogtoResource> WithDataBindMount( this IResourceBuilder<LogtoResource> builder, string source) { // ... }}Parameters
builderIResourceBuilder<LogtoResource>The resource builder for the Logto resource to configure.sourcestringThe host directory to be mounted as the data volume.Returns
IResourceBuilder<LogtoResource>The resource builder for the configured Logto resource.WithDataVolume(IResourceBuilder<LogtoResource>, string?)Section titled WithDataVolume(IResourceBuilder<LogtoResource>, string?)extensionIResourceBuilder<LogtoResource> Configures the Logto resource with a data volume, allowing persistent storage.
public static class LogtoBuilderExtensions{ public static IResourceBuilder<LogtoResource> WithDataVolume( this IResourceBuilder<LogtoResource> builder, string? name = null) { // ... }}Parameters
builderIResourceBuilder<LogtoResource>The resource builder for the Logto resource to configure.namestring?optionalThe 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.WithDeprecationTracing(IResourceBuilder<LogtoResource>)Section titled WithDeprecationTracing(IResourceBuilder<LogtoResource>)extensionIResourceBuilder<LogtoResource> 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.
public static class LogtoBuilderExtensions{ public static IResourceBuilder<LogtoResource> WithDeprecationTracing( this IResourceBuilder<LogtoResource> builderWithResource) { // ... }}Parameters
builderWithResourceIResourceBuilder<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.WithDisableAdminConsole(IResourceBuilder<LogtoResource>, bool)Section titled WithDisableAdminConsole(IResourceBuilder<LogtoResource>, bool)extensionIResourceBuilder<LogtoResource> Configures the Logto resource to disable the Admin Console port.
public static class LogtoBuilderExtensions{ public static IResourceBuilder<LogtoResource> WithDisableAdminConsole( this IResourceBuilder<LogtoResource> builder, bool disable) { // ... }}Parameters
builderIResourceBuilder<LogtoResource>The resource builder for the Logto resource to configure.disableboolA value indicating whether to disable the Admin Console port.Returns
IResourceBuilder<LogtoResource>The resource builder for the configured Logto resource.WithNodeEnv(IResourceBuilder<LogtoResource>, string)Section titled WithNodeEnv(IResourceBuilder<LogtoResource>, string)extensionIResourceBuilder<LogtoResource> Configures the Logto resource to use the specified Node.js environment value by setting the corresponding environment variable.
public static class LogtoBuilderExtensions{ public static IResourceBuilder<LogtoResource> WithNodeEnv( this IResourceBuilder<LogtoResource> builder, string env) { // ... }}Parameters
builderIResourceBuilder<LogtoResource>The resource builder for the Logto resource to configure.envstringThe 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.WithRedis(IResourceBuilder<LogtoResource>, IResourceBuilder<RedisResource>)Section titled WithRedis(IResourceBuilder<LogtoResource>, IResourceBuilder<RedisResource>)extensionIResourceBuilder<LogtoResource> Configures the Logto resource to use a specified Redis resource for caching or other functionality.
public static class LogtoBuilderExtensions{ public static IResourceBuilder<LogtoResource> WithRedis( this IResourceBuilder<LogtoResource> builder, IResourceBuilder<RedisResource> redis) { // ... }}Parameters
builderIResourceBuilder<LogtoResource>The resource builder for the Logto resource to configure.redisIResourceBuilder<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.WithResourcePort(IResourceBuilder<LogtoResource>, int?, int?)Section titled WithResourcePort(IResourceBuilder<LogtoResource>, int?, int?)extensionIResourceBuilder<LogtoResource> Configures HTTP endpoints for the given Logto resource builder with specified port settings.
public static class LogtoBuilderExtensions{ public static IResourceBuilder<LogtoResource> WithResourcePort( this IResourceBuilder<LogtoResource> builder, int? port = null, int? adminPort = null) { // ... }}Parameters
builderIResourceBuilder<LogtoResource>The resource builder for the Logto resource to configure.portint?optionalThe host port to be configured for the primary endpoint. If null, Aspire will assign a random host port.adminPortint?optionalThe 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.WithSecretVault(IResourceBuilder<LogtoResource>, string)Section titled WithSecretVault(IResourceBuilder<LogtoResource>, string)extensionIResourceBuilder<LogtoResource> Configures the Logto resource to use a secret vault with the specified key encryption key (KEK).
public static class LogtoBuilderExtensions{ public static IResourceBuilder<LogtoResource> WithSecretVault( this IResourceBuilder<LogtoResource> builder, string secretVaultKek) { // ... }}Parameters
builderIResourceBuilder<LogtoResource>The resource builder for the Logto resource to configure.secretVaultKekstringThe base64-encoded key encryption key (KEK) for the secret vault.Returns
IResourceBuilder<LogtoResource>The resource builder for the configured Logto resource.WithSensitiveUsername(IResourceBuilder<LogtoResource>, bool)Section titled WithSensitiveUsername(IResourceBuilder<LogtoResource>, bool)extensionIResourceBuilder<LogtoResource> Specifies whether the username is case-sensitive.
public static class LogtoBuilderExtensions{ public static IResourceBuilder<LogtoResource> WithSensitiveUsername( this IResourceBuilder<LogtoResource> builder, bool sensitiveUsername) { // ... }}Parameters
builderIResourceBuilder<LogtoResource>The resource builder for the Logto resource to configure.sensitiveUsernameboolA value indicating whether usernames should be treated as case-sensitive.Returns
IResourceBuilder<LogtoResource>The updated resource builder with the configured case-sensitivity setting.WithTrustProxyHeader(IResourceBuilder<LogtoResource>, bool)Section titled WithTrustProxyHeader(IResourceBuilder<LogtoResource>, bool)extensionIResourceBuilder<LogtoResource> Configures the Logto resource to enable or disable the trust proxy header behavior.
public static class LogtoBuilderExtensions{ public static IResourceBuilder<LogtoResource> WithTrustProxyHeader( this IResourceBuilder<LogtoResource> builder, bool trustProxyHeader) { // ... }}Parameters
builderIResourceBuilder<LogtoResource>The resource builder for the Logto resource to configure.trustProxyHeaderboolA value indicating whether to trust the proxy header.Returns
IResourceBuilder<LogtoResource>The resource builder for the configured Logto resource.