chore(deps): bump github.com/TwiN/health from 1.4.0 to 1.5.0
Bumps [github.com/TwiN/health](https://github.com/TwiN/health) from 1.4.0 to 1.5.0. - [Release notes](https://github.com/TwiN/health/releases) - [Commits](https://github.com/TwiN/health/compare/v1.4.0...v1.5.0) --- updated-dependencies: - dependency-name: github.com/TwiN/health dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
19
vendor/github.com/TwiN/health/README.md
generated
vendored
19
vendor/github.com/TwiN/health/README.md
generated
vendored
@ -28,7 +28,7 @@ server := &http.Server{
|
||||
}
|
||||
```
|
||||
|
||||
By default, the handler will return `UP` when the status is down, and `DOWN` when the status is down.
|
||||
By default, the handler will return `UP` when the status is up, and `DOWN` when the status is down.
|
||||
If you prefer using JSON, however, you may initialize the health handler like so:
|
||||
```go
|
||||
router.Handle("/health", health.Handler().WithJSON(true))
|
||||
@ -37,17 +37,24 @@ The above will cause the response body to become `{"status":"UP"}` and `{"status
|
||||
unless there is a reason, in which case a reason set to `because` would return `{"status":"UP", "reason":"because"}`
|
||||
and `{"status":"DOWN", "reason":"because"}` respectively.
|
||||
|
||||
To set the health status to `DOWN`, you may use `health.SetUnhealthy("<enter reason here>`)` -- the
|
||||
string passed will be automatically set as the reason. In a similar fashion, to set the health status to `UP`,
|
||||
you may use `health.SetHealthy()`.
|
||||
To set the health status to `DOWN` with a reason:
|
||||
```go
|
||||
health.SetUnhealthy("<enter reason here>")
|
||||
```
|
||||
The string passed will be automatically set as the reason.
|
||||
|
||||
Alternatively, to change the health of the application, you can use `health.SetStatus(<status>)` where `<status>` is `health.Up`
|
||||
In a similar fashion, to set the health status to `UP` and clear the reason:
|
||||
```go
|
||||
health.SetHealthy()
|
||||
```
|
||||
|
||||
|
||||
Alternatively, to set the status and the reason individually you can use `health.SetStatus(<status>)` where `<status>` is `health.Up`
|
||||
or `health.Down`:
|
||||
```go
|
||||
health.SetStatus(health.Up)
|
||||
health.SetStatus(health.Down)
|
||||
```
|
||||
|
||||
As for the reason:
|
||||
```go
|
||||
health.SetReason("database is unreachable")
|
||||
|
Reference in New Issue
Block a user