diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ece0e06f..535b27a4 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -20,16 +20,15 @@ jobs: java-version: '17' - name: create application-secret.yml - run: | + run: # create application-secret.yml - # mkdir ./src/main/resources cd ./src/main/resources - # application.yml 파일 생성 + # application-secret.yml 파일 생성 touch ./application-secret.yml - # GitHub-Actions 에서 설정한 값을 application.yml 파일에 쓰기 - # echo "${{ secrets.CI_APPLICATION }}" >> ./application-secret.yml + # GitHub-Actions 에서 설정한 값을 application-secret.yml 파일에 쓰기 + echo "${{ secrets.CI_APPLICATION }}" >> ./application-secret.yml # application.yml 파일 확인 cat ./application-secret.yml 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