diff --git a/deployment.yaml b/deployment.yaml index 2440e73..3323d28 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -27,7 +27,7 @@ spec: - NET_RAW env: - name: PORT - value: "8082" # Ensure this matches the port your app listens on + value: "8080" # Ensure this matches the port your app listens on - name: GIN_MODE value: "release" resources: @@ -40,14 +40,14 @@ spec: readinessProbe: httpGet: path: /readiness - port: 8082 + port: 8080 initialDelaySeconds: 5 periodSeconds: 10 failureThreshold: 3 livenessProbe: httpGet: path: /liveness - port: 8082 + port: 8080 initialDelaySeconds: 15 periodSeconds: 20 failureThreshold: 3 diff --git a/main.go b/main.go index c61ec1d..2750292 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ package main import ( + "fmt" "health/handlers" "log" @@ -8,6 +9,8 @@ import ( "go.uber.org/zap" ) +var serviceName string = "accesscontrol" + // conditionalLogger logs requests only if the status code is not 200 func conditionalLogger() gin.HandlerFunc { return func(c *gin.Context) { @@ -25,8 +28,6 @@ func conditionalLogger() gin.HandlerFunc { } } -var serviceName string = "accesscontrol" - func main() { logger, _ := zap.NewProduction() defer logger.Sync() @@ -44,14 +45,14 @@ func main() { // Liveness probe handler router.GET("/liveness", handlers.LivenessProbeHandler(serviceName)) - // Launch the server in a goroutine go func() { - if err := router.Run("localhost:8082"); err != nil { + // To run in localhost + // router.Run("localhost:8080") + if err := router.Run(); err != nil { // Handle error if server fails to start logger.Error("Failed to start server", zap.Error(err)) } }() - // Keep the main function running - select {} + fmt.Println("Server is running on port 8080") }