Skip to content

Commit 74d2005

Browse files
committed
Infra: EmbeddedRedisConfig 관련 설정 추가
- 작업환경 정보 출력 - 기존 : 맥 환경이면 embedded-redis 비활성화 -> 변경 : 맥 환경이거나 현재 운영환경인 경우 embedded-redis 비활성화
1 parent 496558e commit 74d2005

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/java/com/back/global/config/EmbeddedRedisConfig.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import jakarta.annotation.PostConstruct;
44
import jakarta.annotation.PreDestroy;
5+
import lombok.extern.log4j.Log4j2;
56
import org.springframework.context.annotation.Configuration;
67
import org.springframework.context.annotation.Profile;
78
import redis.embedded.RedisServer;
@@ -17,6 +18,7 @@
1718
*/
1819
@Configuration
1920
@Profile({"dev", "test"})
21+
@Log4j2
2022
public class EmbeddedRedisConfig {
2123

2224
private RedisServer redisServer;
@@ -26,10 +28,12 @@ public class EmbeddedRedisConfig {
2628
public void startRedis() {
2729
try {
2830
String osName = System.getProperty("os.name").toLowerCase();
31+
String activeProfile = System.getProperty("spring.profiles.active", "dev");
32+
log.info("현재환경: " + activeProfile);
2933

30-
// Mac 환경이면 embedded-redis 건너뛰고 docker-compose Redis 사용
31-
if (osName.contains("mac")) {
32-
System.out.println("Mac 환경 감지 → embedded-redis 비활성화, docker-compose Redis 사용");
34+
// 운영환경/Mac 환경이라면 embedded-redis 비활성화
35+
if (osName.contains("mac") || "prod".equalsIgnoreCase(activeProfile)) {
36+
log.info("운영환경/Mac 환경 감지 → embedded-redis 비활성화, 일반 Redis 사용");
3337
System.setProperty("spring.data.redis.port", "6379"); // docker-compose 기본 포트
3438
return;
3539
}

0 commit comments

Comments
 (0)