bagetter / BaGetter

A lightweight NuGet and symbol server
https://www.bagetter.com
MIT License
166 stars 38 forks source link

Add database health check #126

Closed Regenhardt closed 3 months ago

Regenhardt commented 3 months ago

This will return a json like this from the /health endpoint:

{
  "Status": "Healthy",
  "Sqlite": "Healthy"
}

If ListConfiguredServices is turned off, anything but the general Status is omitted.
Alternatively, we could not omit the specific checks entirely but just change the specific service name (e.g. Sqlite) to what the service is used for (e.g. Database).

The db health checks are identified using a tag that simply holds the service. That way any registered health check can be compared to the configuration so only active services are checked.
Alternatively (1), I could add the BaGetter tag to the health checks and use that as additional filter. That way, someone adding BaGetter to their own application could also have their own health checks named/tagged whatever without risk of collisions.
Alternatively (2), I could use the health check's name instead of a tag to identify it. Currently, the name is set to the service type set in the options.

Addresses #108

seriouz commented 3 months ago

A note in the docs on what you have changed would be nice: https://www.bagetter.com/docs/configuration#health-endpoint

Regenhardt commented 3 months ago

Not sure how this ends up in the changelog. I don't usually work with squash commits.

seriouz commented 3 months ago

I am not sure either if the format is 100% correct. Lets do a smaller release in the near feature to see how this goes.