Skip to content

Commit 2cc801c

Browse files
committed
Propagate DOTNET_ENVIRONMENT to seeder, app, and identity resources
Same gap as the subscriptions fix: these generic-host/web resources only check DOTNET_ENVIRONMENT (or its host-specific fallback) to decide whether to accept the self-signed RavenDB server cert, but Aspire doesn't auto-populate it for them. Confirmed locally - seeder previously crashed with an unhandled SSL AuthenticationException during database creation; with this fix the full resource graph (RavenDB, seeder, app, bff, identity, subscriptions) comes up Running end-to-end.
1 parent d438686 commit 2cc801c

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

src/RavenDB.Samples.Verity.AppHost/AppHost.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,12 @@
136136
.WithEnvironment(envSinkCertPfxBase64, sinkCertPfxBase64)
137137
// Server cert path on the host — seeder uses it as client cert to authenticate to RavenDB
138138
.WithEnvironment(envServerCertPath, serverCertPath)
139-
.WithEnvironment(envRavenDbClientCertificatePath, serverCertPath);
139+
.WithEnvironment(envRavenDbClientCertificatePath, serverCertPath)
140+
// Seeder is a generic Host (not WebApplication), so Aspire doesn't auto-populate
141+
// ASPNETCORE_ENVIRONMENT for it; without DOTNET_ENVIRONMENT the self-signed cert
142+
// acceptance in Setup/Program.cs never activates and database creation over the
143+
// secured RavenDB connection fails the TLS handshake.
144+
.WithEnvironment("DOTNET_ENVIRONMENT", "Development");
140145

141146
// Verity App
142147
var functions = builder.AddAzureFunctionsProject<RavenDB_Samples_Verity_App>("app")
@@ -167,7 +172,10 @@
167172
.WithEnvironment(
168173
envHubServerInternalUrl,
169174
ReferenceExpression.Create($"https://localhost:{ravenEndpoint.Property(EndpointProperty.TargetPort)}"))
170-
.WithEnvironment(envRavenDbClientCertificatePath, serverCertPath);
175+
.WithEnvironment(envRavenDbClientCertificatePath, serverCertPath)
176+
// Same DOTNET_ENVIRONMENT gap as seeder/subscriptions — needed for the self-signed
177+
// cert acceptance in App/Program.cs to activate.
178+
.WithEnvironment("DOTNET_ENVIRONMENT", "Development");
171179

172180
// DataSubscriptionsApp — interactive Spectre.Console TUI, must run in its own console window
173181
// cmd /c start spawns a detached window so Aspire doesn't capture stdin/stdout
@@ -200,7 +208,10 @@
200208
.WithExternalHttpEndpoints()
201209
.WithReference(db)
202210
.WaitFor(db)
203-
.WithEnvironment(envRavenDbClientCertificatePath, serverCertPath);
211+
.WithEnvironment(envRavenDbClientCertificatePath, serverCertPath)
212+
// Same DOTNET_ENVIRONMENT gap as seeder/subscriptions/app — needed for the self-signed
213+
// cert acceptance in IdentityServer/Program.cs to activate.
214+
.WithEnvironment("DOTNET_ENVIRONMENT", "Development");
204215
functions.WithEnvironment("Identity__Url", identity.GetEndpoint("http"));
205216
// BFF — single entry point for the browser; proxies API (with tokens) + frontend
206217
var bff = builder.AddProject<RavenDB_Samples_Verity_Bff>("bff")

0 commit comments

Comments
 (0)