a-patel / LiteXHealthChecks

Advanced HealthChecks for ASP.NET Core Applications
MIT License
9 stars 2 forks source link

Don't cache connection string, use connection string factory instead #1

Open vgribok opened 4 years ago

vgribok commented 4 years ago

Current implementation of AddPostgreSql() and PostgreSqlHealthCheck() caches connection string for the lifetime of the running application. This goes against the dynamic nature of IConfiguration that allows dynamic reloading and usage of configuration settings without having to restart the application.

Please follow .NET Core Framework pattern for adding SQL Server health check for an example.

a-patel commented 4 years ago

@vgribok Could you please share your code for dynamic configuration?

vgribok commented 4 years ago

Here's what I mean:

  1. Make health check use connection string factory.
  2. Wire in factory in Startup.cs
a-patel commented 4 years ago

Got it. I will add a new feature. Thanks @vgribok

a-patel commented 4 years ago

I have already started working on upgrading all LiteXHealthChecks to .NET Core 3.0. I will add factory support for all packages.