This commit is contained in:
Tomas Dvorak
2026-01-26 08:13:18 +01:00
parent aa036b6550
commit dfc079288f
505 changed files with 95755 additions and 5712 deletions
+18 -1
View File
@@ -3,9 +3,11 @@ package controllers
import (
"context"
"net/http"
"os"
"runtime"
"time"
"fotbal-club/internal/config"
"fotbal-club/internal/services"
"github.com/gin-gonic/gin"
@@ -22,6 +24,8 @@ type HealthResponse struct {
Status string `json:"status"`
Timestamp time.Time `json:"timestamp"`
Version string `json:"version,omitempty"`
Env string `json:"env,omitempty"`
Premium bool `json:"premium,omitempty"`
Checks map[string]CheckResult `json:"checks"`
System SystemInfo `json:"system,omitempty"`
}
@@ -100,6 +104,17 @@ func (hc *HealthController) Health(c *gin.Context) {
ctx, cancel := context.WithTimeout(c.Request.Context(), 10*time.Second)
defer cancel()
env := ""
premium := false
if config.AppConfig != nil {
env = config.AppConfig.AppEnv
premium = config.AppConfig.Premium
}
version := os.Getenv("APP_VERSION")
if version == "" {
version = "dev"
}
checks := make(map[string]CheckResult)
overallStatus := "healthy"
@@ -122,7 +137,9 @@ func (hc *HealthController) Health(c *gin.Context) {
response := HealthResponse{
Status: overallStatus,
Timestamp: time.Now(),
Version: "1.0.0", // Use actual version
Version: version, // Use actual version
Env: env,
Premium: premium,
Checks: checks,
System: sysInfo,
}