Table of Contents

Class RootSettingsBootstrap

Namespace
MailFathom.Infrastructure.Persistence.Settings
Assembly
MailFathom.Infrastructure.dll

Reads the persisted configuration once, before the host has a container to resolve anything from.

public static class RootSettingsBootstrap
Inheritance
RootSettingsBootstrap
Inherited Members

Remarks

The host composes its configuration before it composes its services, so the layer between the deployment's files and the operator's overrides has to be readable at a moment when nothing is registered. Everything the read needs is therefore built here and torn down again: the secret adapters that turn the configured references into credentials, and one data source that opens a single connection.

Where a secret block supplies the credential — a password block, or a block referencing a whole connection string — it is supplied per physical connection through Npgsql's own callback rather than baked into the connection string, exactly as the long-lived pool supplies it, so bootstrap keeps no credential in memory after the connection it authenticated. A deployment that instead writes the password into Persistence:ConnectionString or ConnectionStrings:mailfathom as ordinary configuration is passed through unchanged, and the credential is in the connection string here exactly as it is in the pool's; PostgresConnectionStringProvider reports that shape as a configuration diagnostic and this read makes no attempt to improve on it. The data source is disposed before this returns either way, so no pool outlives the one read it existed for.

Both legs that reach the server are bounded, because they run before any endpoint is open and therefore before anything could report that the host is still starting. The command carries the deployment's own command timeout, and the connect attempt carries the driver's default wherever the connection string left it infinite: a server that accepts TCP without finishing the handshake, or accepts the connection and then never answers the statement, would otherwise hold the process there for as long as it stayed silent, and the caller composing configuration has no deadline of its own to fall back on.

Methods

ReadAsync(PostgresConnectionSettings, SecretValueInterpretation, TimeSpan, CancellationToken)

Reads the deployment's persisted configuration document.