diff --git a/src/main/java/team7/inplace/security/config/RedisConfig.java b/src/main/java/team7/inplace/security/config/RedisConfig.java index 425cbcae..980689e4 100644 --- a/src/main/java/team7/inplace/security/config/RedisConfig.java +++ b/src/main/java/team7/inplace/security/config/RedisConfig.java @@ -1,5 +1,6 @@ package team7.inplace.security.config; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.RedisStandaloneConfiguration; @@ -10,9 +11,16 @@ @Configuration public class RedisConfig { + @Value("${redis.db.url}") + private String redisDBUrl; + + @Value("${redis.db.port}") + private Integer redisDBPort; + @Bean LettuceConnectionFactory redisConnectionFactory() { - return new LettuceConnectionFactory(new RedisStandaloneConfiguration("localhost", 6379)); + return new LettuceConnectionFactory( + new RedisStandaloneConfiguration(redisDBUrl, redisDBPort)); } @Bean diff --git a/src/main/resources/application-redis.yaml b/src/main/resources/application-redis.yaml new file mode 100644 index 00000000..c6585435 --- /dev/null +++ b/src/main/resources/application-redis.yaml @@ -0,0 +1,4 @@ +redis: + db: + url: ${REDIS_DATABASE_URL} + port: ${REDIS_DATABASE_PORT} diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index e5b3642d..767b4ebd 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -5,4 +5,5 @@ spring: - classpath:application-youtube.yaml - classpath:application-kakao.yaml - classpath:application-db.yaml + - classpath:application-redis.yaml - optional:file:.env[.properties]