feat(api): add healthcheck endpoint for monitoring health from Docker/Podman (#2024)

This commit is contained in:
David Long
2025-12-30 11:54:30 -07:00
committed by GitHub
parent 1b27ca3028
commit 8580670b6e
5 changed files with 42 additions and 1 deletions
@@ -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 = {
@@ -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"));
}
}