diff --git a/src/main/java/com/mpnp/baechelin/api/controller/LocationController.java b/src/main/java/com/mpnp/baechelin/api/controller/LocationController.java index b681877..b529878 100644 --- a/src/main/java/com/mpnp/baechelin/api/controller/LocationController.java +++ b/src/main/java/com/mpnp/baechelin/api/controller/LocationController.java @@ -48,8 +48,4 @@ public List getKeywordByGeoAndAddress(@Request @RequestParam String address) { return locationService.convertGeoAndAddressToKeyword(String.valueOf(lat), String.valueOf(lng), address); } - @GetMapping("/health") - public String main(){ - return "Good"; - } } \ No newline at end of file diff --git a/src/main/java/com/mpnp/baechelin/util/Nginx.java b/src/main/java/com/mpnp/baechelin/util/Nginx.java new file mode 100644 index 0000000..4dc0cd1 --- /dev/null +++ b/src/main/java/com/mpnp/baechelin/util/Nginx.java @@ -0,0 +1,27 @@ +package com.mpnp.baechelin.util; + +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.core.env.Environment; + +import java.util.Arrays; +import java.util.List; + +@RequiredArgsConstructor +@RestController +public class Nginx { + private final Environment environment; + + @GetMapping("/health") + public String main() { + final List profiles = Arrays.asList(environment.getActiveProfiles()); + final List prodProfiles = Arrays.asList("prod1", "prod2"); + final String defaultProfile = profiles.get(0); + + return Arrays.stream(environment.getActiveProfiles()) + .filter(prodProfiles::contains) + .findAny() + .orElse(defaultProfile); + } +}