-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
34 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// The Licensed Work is (c) 2023 Sygma | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
package health | ||
|
||
import ( | ||
"fmt" | ||
"net/http" | ||
|
||
"github.com/rs/zerolog/log" | ||
) | ||
|
||
// StartHealthEndpoint starts /health endpoint on provided port that returns ok on invocation | ||
func StartHealthEndpoint(port uint16) { | ||
http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) { | ||
_, _ = w.Write([]byte("ok")) | ||
}) | ||
|
||
_ = http.ListenAndServe(fmt.Sprintf(":%d", port), nil) | ||
log.Info().Msgf("started /health endpoint on port %d", port) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters