mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-29 03:14:17 +01:00
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:
parent
d4983733f5
commit
ebdf5bde49
2
go.mod
2
go.mod
@ -5,7 +5,7 @@ go 1.19
|
|||||||
require (
|
require (
|
||||||
github.com/TwiN/g8 v1.4.0
|
github.com/TwiN/g8 v1.4.0
|
||||||
github.com/TwiN/gocache/v2 v2.1.1
|
github.com/TwiN/gocache/v2 v2.1.1
|
||||||
github.com/TwiN/health v1.4.0
|
github.com/TwiN/health v1.5.0
|
||||||
github.com/TwiN/whois v1.0.0
|
github.com/TwiN/whois v1.0.0
|
||||||
github.com/coreos/go-oidc/v3 v3.1.0
|
github.com/coreos/go-oidc/v3 v3.1.0
|
||||||
github.com/go-ping/ping v0.0.0-20210911151512-381826476871
|
github.com/go-ping/ping v0.0.0-20210911151512-381826476871
|
||||||
|
4
go.sum
4
go.sum
@ -37,8 +37,8 @@ github.com/TwiN/g8 v1.4.0 h1:RUk5xTtxKCdMo0GGSbBVyjtAAfi2nqVbA9E0C4u5Cxo=
|
|||||||
github.com/TwiN/g8 v1.4.0/go.mod h1:ECyGJsoIb99klUfvVQoS1StgRLte9yvvPigGrHdy284=
|
github.com/TwiN/g8 v1.4.0/go.mod h1:ECyGJsoIb99klUfvVQoS1StgRLte9yvvPigGrHdy284=
|
||||||
github.com/TwiN/gocache/v2 v2.1.1 h1:W/GLImqa+pZVIH9pcWEn1cBgy1KU66fUcBjOnPhjuno=
|
github.com/TwiN/gocache/v2 v2.1.1 h1:W/GLImqa+pZVIH9pcWEn1cBgy1KU66fUcBjOnPhjuno=
|
||||||
github.com/TwiN/gocache/v2 v2.1.1/go.mod h1:SnUuBsrwGQeNcDG6vhkOMJnqErZM0JGjgIkuKryokYA=
|
github.com/TwiN/gocache/v2 v2.1.1/go.mod h1:SnUuBsrwGQeNcDG6vhkOMJnqErZM0JGjgIkuKryokYA=
|
||||||
github.com/TwiN/health v1.4.0 h1:Ts7lb4ihYDpVEbFSGAhSEZTSwuDOADnwJLFngFl4xzw=
|
github.com/TwiN/health v1.5.0 h1:ETTtbQfUbiiIiVTSpAiNzesHQvm8qarV/8ctlZsVhwA=
|
||||||
github.com/TwiN/health v1.4.0/go.mod h1:CSUh+ryfD2POS2vKtc/yO4IxgR58lKvQ0/8qnoPqPqs=
|
github.com/TwiN/health v1.5.0/go.mod h1:Z6TszwQPMvtSiVx1QMidVRgvVr4KZGfiwqcD7/Z+3iw=
|
||||||
github.com/TwiN/whois v1.0.0 h1:I+aQzXLPmhWovkFUzlPV2DdfLZUWDLrkMDlM6QwCv+Q=
|
github.com/TwiN/whois v1.0.0 h1:I+aQzXLPmhWovkFUzlPV2DdfLZUWDLrkMDlM6QwCv+Q=
|
||||||
github.com/TwiN/whois v1.0.0/go.mod h1:9WbCzYlR+r5eq9vbgJVh7A4H2uR2ct4wKEB0/QITJ/c=
|
github.com/TwiN/whois v1.0.0/go.mod h1:9WbCzYlR+r5eq9vbgJVh7A4H2uR2ct4wKEB0/QITJ/c=
|
||||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
|
21
vendor/github.com/TwiN/health/LICENSE
generated
vendored
Normal file
21
vendor/github.com/TwiN/health/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2022 TwiN
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
9
vendor/github.com/TwiN/health/LICENSE.md
generated
vendored
9
vendor/github.com/TwiN/health/LICENSE.md
generated
vendored
@ -1,9 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2022 TwiN
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
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:
|
If you prefer using JSON, however, you may initialize the health handler like so:
|
||||||
```go
|
```go
|
||||||
router.Handle("/health", health.Handler().WithJSON(true))
|
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"}`
|
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.
|
and `{"status":"DOWN", "reason":"because"}` respectively.
|
||||||
|
|
||||||
To set the health status to `DOWN`, you may use `health.SetUnhealthy("<enter reason here>`)` -- the
|
To set the health status to `DOWN` with a reason:
|
||||||
string passed will be automatically set as the reason. In a similar fashion, to set the health status to `UP`,
|
```go
|
||||||
you may use `health.SetHealthy()`.
|
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`:
|
or `health.Down`:
|
||||||
```go
|
```go
|
||||||
health.SetStatus(health.Up)
|
health.SetStatus(health.Up)
|
||||||
health.SetStatus(health.Down)
|
health.SetStatus(health.Down)
|
||||||
```
|
```
|
||||||
|
|
||||||
As for the reason:
|
As for the reason:
|
||||||
```go
|
```go
|
||||||
health.SetReason("database is unreachable")
|
health.SetReason("database is unreachable")
|
||||||
|
11
vendor/github.com/TwiN/health/health.go
generated
vendored
11
vendor/github.com/TwiN/health/health.go
generated
vendored
@ -105,14 +105,19 @@ func SetStatusAndReason(status Status, reason string) {
|
|||||||
handler.mutex.Unlock()
|
handler.mutex.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetHealthy sets the status to Up and the reason to a blank string
|
// SetStatusAndResetReason sets the status and resets the reason to a blank string
|
||||||
func SetHealthy() {
|
func SetStatusAndResetReason(status Status) {
|
||||||
handler.mutex.Lock()
|
handler.mutex.Lock()
|
||||||
handler.status = Up
|
handler.status = status
|
||||||
handler.reason = ""
|
handler.reason = ""
|
||||||
handler.mutex.Unlock()
|
handler.mutex.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetHealthy sets the status to Up and the reason to a blank string
|
||||||
|
func SetHealthy() {
|
||||||
|
SetStatusAndResetReason(Up)
|
||||||
|
}
|
||||||
|
|
||||||
// SetUnhealthy sets the status to Down and the reason to the string passed as parameter
|
// SetUnhealthy sets the status to Down and the reason to the string passed as parameter
|
||||||
//
|
//
|
||||||
// Unlike SetHealthy, this function enforces setting a reason, because it's good practice to give at least a bit
|
// Unlike SetHealthy, this function enforces setting a reason, because it's good practice to give at least a bit
|
||||||
|
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
@ -4,8 +4,8 @@ github.com/TwiN/g8
|
|||||||
# github.com/TwiN/gocache/v2 v2.1.1
|
# github.com/TwiN/gocache/v2 v2.1.1
|
||||||
## explicit; go 1.19
|
## explicit; go 1.19
|
||||||
github.com/TwiN/gocache/v2
|
github.com/TwiN/gocache/v2
|
||||||
# github.com/TwiN/health v1.4.0
|
# github.com/TwiN/health v1.5.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.19
|
||||||
github.com/TwiN/health
|
github.com/TwiN/health
|
||||||
# github.com/TwiN/whois v1.0.0
|
# github.com/TwiN/whois v1.0.0
|
||||||
## explicit; go 1.19
|
## explicit; go 1.19
|
||||||
|
Loading…
Reference in New Issue
Block a user