dotnet / aspire

Tools, templates, and packages to accelerate building observable, production-ready apps
https://learn.microsoft.com/dotnet/aspire
MIT License
3.91k stars 476 forks source link

Show Connection Strings on Dashboard #6627

Open afscrome opened 2 weeks ago

afscrome commented 2 weeks ago

Is there an existing issue for this?

Is your feature request related to a problem? Please describe the problem.

The aspire dashboard doesn't provide an easy way to get connection strings for resources with connection strings. Whilst you can often work out the connection string by finding an environment variable in a resource the connection string was injected into, this doesn't help if you're troubleshooting a Health Check failure, which means none of the later resources are starting and so don't show environment variables.

Describe the solution you'd like

The aspire dashboard should provide a way to show connection strings for resources when being run locally.

Additional context

Sample code to reproduce a health check failure

var connectionString = builder.AddConnectionString("fake");
var sql2 = builder.AddSqlServer("test")
   .WithConnectionStringRedirection(connectionString.Resource);

with app settings.json

{
  "ConnectionStrings": {
    "fake": "server=DOES-NOT-EXIST"
  }
}
joperezr commented 1 week ago

Thanks for the suggestion @afscrome. This would be useful. We need to have UI design for the feature before we can implement this.

afscrome commented 1 week ago

My suggestion for now would be to add it as a resource property Connection String as an initially redacted string.

Image

Longer term it could be worth adding a dedicated "Connection Strings" panel, although that's probably not worth doing until progress has been made on #2111 .

davidfowl commented 4 days ago

Dupe of https://github.com/dotnet/aspire/issues/4974