Skip to content

Commit

Permalink
Merge pull request #25 from InseeFr/healthcheck
Browse files Browse the repository at this point in the history
feat: add healthcheck
  • Loading branch information
SimonDmz authored Sep 11, 2023
2 parents 36d1903 + da891a8 commit 81e080c
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>
<groupId>fr.insee.survey</groupId>
<artifactId>platine-management</artifactId>
<version>1.0.21-rc</version>
<version>1.0.22-rc</version>
<name>platine-management</name>
<description>REST API for communication between DB and Platine-Management UI and Platine-My-Surveys UI</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.springframework.security.config.Customizer.withDefaults;

import fr.insee.survey.datacollectionmanagement.constants.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
Expand Down Expand Up @@ -33,7 +34,7 @@ protected SecurityFilterChain configure(HttpSecurity http) throws Exception {
.authorizeRequests()
.antMatchers("/csrf", "/", "/webjars/**", "/swagger-resources/**").permitAll()
.antMatchers("/environnement").permitAll()// PublicResources
.antMatchers("/healthcheck").permitAll()
.antMatchers(Constants.API_HEALTHCHECK).permitAll()
.antMatchers("/actuator/**").permitAll()
.antMatchers("/swagger-ui/*").permitAll()
.antMatchers("/v3/api-docs/swagger-config", "/v3/api-docs").permitAll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import java.util.List;

import fr.insee.survey.datacollectionmanagement.constants.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
Expand Down Expand Up @@ -39,7 +40,7 @@ protected SecurityFilterChain configure(HttpSecurity http) throws Exception {
.authorizeRequests()
.antMatchers("/csrf", "/", "/webjars/**", "/swagger-resources/**").permitAll()
.antMatchers("/environnement").permitAll()//PublicResources
.antMatchers("/healthcheck").permitAll()
.antMatchers(Constants.API_HEALTHCHECK).permitAll()
.antMatchers("/actuator/**").permitAll()
.antMatchers("/swagger-ui/*").permitAll()
.antMatchers("/v3/api-docs/swagger-config", "/v3/api-docs").permitAll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,6 @@ private Constants() {
public static final String INTERVIEWER = "interviewer";
public static final String REVIEWER = "reviewer";

public static final String API_HEALTHCHECK = "/api/healthcheck";

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package fr.insee.survey.datacollectionmanagement.heathcheck.controller;

import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.heathcheck.dto.HealthcheckDto;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Tag(name = "8 - Healthcheck", description = "healthcheck")
public class HealthcheckController {

@GetMapping(path = Constants.API_HEALTHCHECK, produces = "application/json")
public ResponseEntity<HealthcheckDto> healthcheck() {
HealthcheckDto dto = new HealthcheckDto();
dto.setStatus("OK");
return ResponseEntity.ok().body(dto);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package fr.insee.survey.datacollectionmanagement.heathcheck.dto;

import lombok.Data;

@Data
public class HealthcheckDto {

private String status;
}

0 comments on commit 81e080c

Please sign in to comment.