SteeltoeOSS / Steeltoe

.NET Components for Externalized Configuration, Database Connectors, Service Discovery, Logging and Distributed Tracing, Application Management, Security, and more.
https://steeltoe.io
Apache License 2.0
1.01k stars 163 forks source link

Mapping bindings into connection string section of .NET configuration #1326

Open macsux opened 4 months ago

macsux commented 4 months ago

Customers are often looking at Steeltoe in context of adoption Cloud Foundry or one of Tanzu products. These are existing applications that have been written to "standard" .NET approach. As such, most the time when such applications read connection strings, they do so out of ConnectionStrings section in appsettings.json via code that often uses call like this: Configuration.GetConnectionString("BloggingDatabase"). Steeltoe V3 had a feature that mapped a service binding into a matching connection string entry inside this section, so any application being replatformed can take advantage of service bindings without having to refactor any of the code. It seems that this feature has been dropped in Steeltoe v4.

Describe the solution you'd like

Add back the feature that mapped service bindings into ConnectionStrings section inside the IConfiguration so they can be accessed via standard .NET connection string mechanism.

Describe alternatives you've considered

This behavior can also be put into a buildpack if one is ever introduced.