Simple Go health handler
MIT License
Bot releases are hidden (Show)
feat: Add GetResponseStatusCodeAndBody for non-stdlib routers
Published by TwiN about 2 years ago
Full Changelog: https://github.com/TwiN/health/compare/v1.4.1...v1.5.0
Published by TwiN about 2 years ago
chore: Update Go to 1.19
Published by TwiN over 2 years ago
Added SetHealthy
and SetUnhealthy
functions
Published by TwiN almost 3 years ago
Added SetStatusAndReason
function
Published by TwiN almost 3 years ago
Minor improvements
Published by TwiN almost 3 years ago
Added optional reason
parameter, which can be set using SetReason
and retrieved using GetReason
.
health.Down
and the reason is "database unreachable"
If JSON is enabled (WithJSON(true)
):
{
"status": "DOWN",
"reason": "database unreachable"
}
If JSON is not enabled:
DOWN: database unreachable
health.Up
and the reason is not set (""
)If JSON is enabled (WithJSON(true)
):
{
"status": "UP"
}
If JSON is not enabled:
UP
In other words, if the reason is empty, it is as if the parameter does not exist. This is by design.
Published by TwiN almost 3 years ago
GetStatus
function to retrieve current statusPublished by TwiN about 3 years ago
⚠ Migrated TwinProduction/health to TwiN/health
Published by TwiN over 3 years ago
First release