Open davidfowl opened 5 months ago
I think this could be useful in this situation where people might want to specify configuration in the appsettings.json
but need to pass in the Url via an environment variable to override. For example: https://github.com/dotnet/aspire/issues/3695
I'm partial to using GetEndpoint
to avoid assigning static ports to projects locally while still being able to access the endpoints used for non-HttpClient scenarios (e.g. populating links to other localhost projects in Blazor pages).
Simplest way to do this is to break up your fluent API calls:
var auth = builder.AddProject<AuthService>("auth")
.WithReference(db)
.WithReference(legacyDb);
var admin = builder.AddProject<Admin>("admin")
.WithEnvironment("AdminUi__AuthorityUrl", auth.GetEndpoint("http"))
.WithReference(db);
admin.WithEnvironment(context =>
{
context.EnvironmentVariables["AdminUi__UiUrl"] = admin.GetEndpoint("http");
})
Discussed in https://github.com/dotnet/aspire/discussions/3522