Rename HealthcheckParams and HealthcheckResponse to avoid stuttering
This commit is contained in:
@@ -13,8 +13,8 @@ import (
|
||||
"sneak.berlin/go/pixa/internal/logger"
|
||||
)
|
||||
|
||||
// HealthcheckParams defines dependencies for Healthcheck.
|
||||
type HealthcheckParams struct {
|
||||
// Params defines dependencies for Healthcheck.
|
||||
type Params struct {
|
||||
fx.In
|
||||
Globals *globals.Globals
|
||||
Config *config.Config
|
||||
@@ -31,7 +31,7 @@ type Healthcheck struct {
|
||||
}
|
||||
|
||||
// New creates a new Healthcheck instance.
|
||||
func New(lc fx.Lifecycle, params HealthcheckParams) (*Healthcheck, error) {
|
||||
func New(lc fx.Lifecycle, params Params) (*Healthcheck, error) {
|
||||
s := &Healthcheck{
|
||||
log: params.Logger.Get(),
|
||||
globals: params.Globals,
|
||||
@@ -52,8 +52,8 @@ func New(lc fx.Lifecycle, params HealthcheckParams) (*Healthcheck, error) {
|
||||
return s, nil
|
||||
}
|
||||
|
||||
// HealthcheckResponse is the JSON response for health checks.
|
||||
type HealthcheckResponse struct {
|
||||
// Response is the JSON response for health checks.
|
||||
type Response struct {
|
||||
Status string `json:"status"`
|
||||
Now string `json:"now"`
|
||||
UptimeSeconds int64 `json:"uptime_seconds"`
|
||||
@@ -68,8 +68,8 @@ func (s *Healthcheck) uptime() time.Duration {
|
||||
}
|
||||
|
||||
// Healthcheck returns the current health status.
|
||||
func (s *Healthcheck) Healthcheck() *HealthcheckResponse {
|
||||
resp := &HealthcheckResponse{
|
||||
func (s *Healthcheck) Healthcheck() *Response {
|
||||
resp := &Response{
|
||||
Status: "ok",
|
||||
Now: time.Now().UTC().Format(time.RFC3339Nano),
|
||||
UptimeSeconds: int64(s.uptime().Seconds()),
|
||||
|
||||
Reference in New Issue
Block a user