feat: add AddStandardMailHog/AddStandardPostgres Aspire AppHost helpers - #163
Merged
Conversation
This was referenced Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
5 AppHost.cs files across the ecosystem (andregoepel-dev, finance-app, customer-portal, this repo's own sample, marten-identity's sample) hand-roll ~65%-identical MailHog + Postgres +
EmailSender__*blocks. New packable projectAndreGoepel.AppFoundation.Aspireextracts the container-wiring core.Two things this fixes along the way
MailHog endpoint name standardized on
"http"(not"web") — matchesAndreGoepel.Testing.E2E'sE2EAppFixtureOptions.MailHogEndpointNamedefault, shipped in Wave 1. andregoepel-dev/finance-app currently use"web"; customer-portal/this repo already used"http". Adopting this helper fixes the inconsistency as a side effect.isE2E gate exists everywhere now.
AddStandardPostgres(isE2E, ...)skipsWithDataVolume, persistent lifetime, and the fixed host port whenisE2Eis true. Confirmed by reading all 5 AppHosts: finance-app already gates all three; marten-identity gates the volume; andregoepel-dev and customer-portal currently have no isE2E gate at all — their Postgres always persists regardless of E2E mode. That gap is exactly what customer-portal#91 and andregoepel-dev#58 (both already filed) should pick up when they adopt this package.Design
AddStandardMailHog(builder, name, tag, smtpPort, httpPort)returns the container resource so callers can still wire up their own app-specificEmailSender__*env vars (sender name/credentials stay app-specific, not standardized).AddStandardPostgres(builder, isE2E, ...)returns aStandardPostgres(Server, Database)record, deconstructible so the common case stays a one-liner:var (_, db) = builder.AddStandardPostgres(isE2E);.core → marten-* → app-foundation → host appsdependency order the root CLAUDE.md governs — same reasoning that already putsServiceDefaultshere.AppHost.csmigrated to dogfood both helpers.Verification
dotnet csharpier format .cleandotnet build— 0 warnings, 0 errorsdotnet test— 119 tests passing total (5 new, resource-model only — no Docker needed): MailHog endpoint names/ports, Postgres isE2E gating of volume/lifetime, database-name-vs-resource-name distinctiondotnet list package --vulnerable --include-transitive— cleanCloses #154. Follow-ups tracked separately: finance-app#69, customer-portal#91, andregoepel-dev#58 (isE2E gate adoption + endpoint rename in the 3 repos still on the old pattern).