diff --git a/build.gradle b/build.gradle index ad2653f2..96a765b8 100644 --- a/build.gradle +++ b/build.gradle @@ -27,6 +27,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springframework.boot:spring-boot-starter-actuator' compileOnly 'org.projectlombok:lombok' runtimeOnly 'org.postgresql:postgresql' annotationProcessor 'org.projectlombok:lombok' diff --git a/src/main/java/com/tiki/server/controller/ProfileController.java b/src/main/java/com/tiki/server/controller/ProfileController.java new file mode 100644 index 00000000..9f79cc13 --- /dev/null +++ b/src/main/java/com/tiki/server/controller/ProfileController.java @@ -0,0 +1,23 @@ +package com.tiki.server.controller; + +import lombok.RequiredArgsConstructor; +import org.springframework.core.env.Environment; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Arrays; + +@RestController +@RequiredArgsConstructor +public class ProfileController { + + private final Environment env; + private static final String NULL = ""; + + @GetMapping("/profile") + public String getProfile() { + return Arrays.stream(env.getActiveProfiles()) + .findFirst() + .orElse(NULL); + } +} \ No newline at end of file