dotnet / aspire

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

Support named configuration providers for Aspire resources #5826

Closed captainsafia closed 1 month ago

captainsafia commented 1 month ago

Aspire resource support Configuration-based models for configuring resources under well-defined keys. For example, Storage Blob resources support configuration under the Aspire:Azure:Storage:Blobs key.

{
  "Aspire": {
    "Azure": {
      "Storage": {
        "Blobs": {
          "DisableHealthChecks": true,
          "DisableTracing": false,
          "ClientOptions": {
            "Diagnostics": {
              "ApplicationId": "myapp"
            }
          }
        }
      }
    }
  }
}

This configuration model doesn't currently support different configurations for different instances of the same resource type in an application. To address this, we'll update the resource configuration strategy to support instances keyed by name as follows:

{
  "Aspire": {
    "Azure": {
      "Storage": {
        "Blobs": {
           "blob1": { .. },
           "blob2": { ..},
        }
      }
    }
  }
}

At the moment, the primary motivation for doing this is to provide a resolution for the "dual config dilemma" documented in https://github.com/dotnet/aspire/issues/5563 since the existing configuration provider key name scheme doesn't conflict with Azure WebJob's lookup semantics.

Tracked Integrations

joperezr commented 1 month ago

While this is in PR, there will be some post-9.0 work.