dotnet / aspire

An opinionated, cloud ready stack for building observable, production ready, distributed applications in .NET
https://learn.microsoft.com/dotnet/aspire
MIT License
3.79k stars 440 forks source link

Consider adding concept of resource configuration to Aspire.Hosting #2436

Open DamianEdwards opened 7 months ago

DamianEdwards commented 7 months ago

Today in AppHost projects, resources are typically configured by calling WithEnvironment to inject an environment variable with a specific value into the resource's model. We should consider adding a layer above this logically based on the existing IConfiguration system from Microsoft.Extensions.Configuration, facilitating the separation of a resource specifying it requires some configuration value and where that value actually comes from.

This could then be coupled with a generic concept of tags for configuration values such that values with a specific tag could be supplied from a specific provider/store, e.g. configuration values tagged as "secret" could be stored in/supplied from user secrets when running locally, and a secret store (e.g. Azure KeyVault) when publishing.

davidfowl commented 7 months ago

cc @mitchdenny

mitchdenny commented 7 months ago

Can you give us an example in code of what you are thinking here @DamianEdwards ... I'm not sure whether I am getting it from the description above.