Skip to content

Commit

Permalink
[Feat] 환경 상태 확인하는 프로필 컨트롤러 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jinkonu committed May 25, 2024
1 parent 953f53a commit 0de29a6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions planfit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies {
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
}

tasks.named('test') {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.planfit.server.controller;

import com.planfit.server.service.UserService;
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;

@RequiredArgsConstructor
@RestController
public class ProfileController {

private final Environment environment;
private static final String NULL = "";

@GetMapping("/profile")
public String getProfile() {
return Arrays.stream(environment.getActiveProfiles())
.findFirst()
.orElse(NULL);
}
}

0 comments on commit 0de29a6

Please sign in to comment.