From ebdf5bde491dfcf2a97f0284e95a96d3e1e45162 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Nov 2022 03:31:35 +0000 Subject: [PATCH] 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] --- go.mod | 2 +- go.sum | 4 ++-- vendor/github.com/TwiN/health/LICENSE | 21 +++++++++++++++++++++ vendor/github.com/TwiN/health/LICENSE.md | 9 --------- vendor/github.com/TwiN/health/README.md | 19 +++++++++++++------ vendor/github.com/TwiN/health/health.go | 11 ++++++++--- vendor/modules.txt | 4 ++-- 7 files changed, 47 insertions(+), 23 deletions(-) create mode 100644 vendor/github.com/TwiN/health/LICENSE delete mode 100644 vendor/github.com/TwiN/health/LICENSE.md diff --git a/go.mod b/go.mod index f9732831..16dc2397 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( github.com/TwiN/g8 v1.4.0 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/coreos/go-oidc/v3 v3.1.0 github.com/go-ping/ping v0.0.0-20210911151512-381826476871 diff --git a/go.sum b/go.sum index 82931081..0b36537f 100644 --- a/go.sum +++ b/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/gocache/v2 v2.1.1 h1:W/GLImqa+pZVIH9pcWEn1cBgy1KU66fUcBjOnPhjuno= 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.4.0/go.mod h1:CSUh+ryfD2POS2vKtc/yO4IxgR58lKvQ0/8qnoPqPqs= +github.com/TwiN/health v1.5.0 h1:ETTtbQfUbiiIiVTSpAiNzesHQvm8qarV/8ctlZsVhwA= +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/go.mod h1:9WbCzYlR+r5eq9vbgJVh7A4H2uR2ct4wKEB0/QITJ/c= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= diff --git a/vendor/github.com/TwiN/health/LICENSE b/vendor/github.com/TwiN/health/LICENSE new file mode 100644 index 00000000..ea31ca11 --- /dev/null +++ b/vendor/github.com/TwiN/health/LICENSE @@ -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. diff --git a/vendor/github.com/TwiN/health/LICENSE.md b/vendor/github.com/TwiN/health/LICENSE.md deleted file mode 100644 index 3453cb7b..00000000 --- a/vendor/github.com/TwiN/health/LICENSE.md +++ /dev/null @@ -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. diff --git a/vendor/github.com/TwiN/health/README.md b/vendor/github.com/TwiN/health/README.md index ff50a1fb..624d29d2 100644 --- a/vendor/github.com/TwiN/health/README.md +++ b/vendor/github.com/TwiN/health/README.md @@ -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("`)` -- 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("") +``` +The string passed will be automatically set as the reason. -Alternatively, to change the health of the application, you can use `health.SetStatus()` where `` 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()` where `` 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") diff --git a/vendor/github.com/TwiN/health/health.go b/vendor/github.com/TwiN/health/health.go index 527e7bb7..23964483 100644 --- a/vendor/github.com/TwiN/health/health.go +++ b/vendor/github.com/TwiN/health/health.go @@ -105,14 +105,19 @@ func SetStatusAndReason(status Status, reason string) { handler.mutex.Unlock() } -// SetHealthy sets the status to Up and the reason to a blank string -func SetHealthy() { +// SetStatusAndResetReason sets the status and resets the reason to a blank string +func SetStatusAndResetReason(status Status) { handler.mutex.Lock() - handler.status = Up + handler.status = status handler.reason = "" 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 // // Unlike SetHealthy, this function enforces setting a reason, because it's good practice to give at least a bit diff --git a/vendor/modules.txt b/vendor/modules.txt index 2a4a4b1c..5ddbd6e9 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -4,8 +4,8 @@ github.com/TwiN/g8 # github.com/TwiN/gocache/v2 v2.1.1 ## explicit; go 1.19 github.com/TwiN/gocache/v2 -# github.com/TwiN/health v1.4.0 -## explicit; go 1.18 +# github.com/TwiN/health v1.5.0 +## explicit; go 1.19 github.com/TwiN/health # github.com/TwiN/whois v1.0.0 ## explicit; go 1.19