feat(api): add healthcheck endpoint for monitoring health from Docker/Podman (#2024)
This commit is contained in:
+2
-1
@@ -50,7 +50,8 @@ public class SecurityConfig {
|
||||
"/kobo/**", // Kobo API requests (auth handled in KoboAuthFilter)
|
||||
"/api/v1/auth/**", // Login and token refresh endpoints (must remain public)
|
||||
"/api/v1/public-settings", // Public endpoint for checking OIDC or other app settings
|
||||
"/api/v1/setup/**" // Setup wizard endpoints (must remain accessible before initial setup)
|
||||
"/api/v1/setup/**", // Setup wizard endpoints (must remain accessible before initial setup)
|
||||
"/api/v1/healthcheck/**" // Healthcheck endpoints (must remain accessible for Docker healthchecks)
|
||||
};
|
||||
|
||||
private static final String[] COMMON_UNAUTHENTICATED_ENDPOINTS = {
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.adityachandel.booklore.controller;
|
||||
|
||||
import com.adityachandel.booklore.model.dto.response.SuccessResponse;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/healthcheck")
|
||||
@Tag(name = "Healthcheck", description = "Endpoints for checking the healch of the application")
|
||||
public class HealthcheckController {
|
||||
|
||||
@Operation(summary = "Get a ping response", description = "Check if the application is responding to requests")
|
||||
@ApiResponse(responseCode = "200", description = "Health status returned successfully")
|
||||
@GetMapping
|
||||
public ResponseEntity<?> getPing() {
|
||||
return ResponseEntity.ok(new SuccessResponse<>(200, "Pong"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user