Skip to content

Commit

Permalink
[#291] refactor(RedisConfig): password 설정 추가
Browse files Browse the repository at this point in the history
- main에 머지 전 prod 레디스에 비밀번호 설정 필요함.
  • Loading branch information
hoonyworld committed Dec 24, 2024
1 parent 4364060 commit 4886e90
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/com/beat/global/common/config/RedisConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;

Expand All @@ -16,9 +17,14 @@ public class RedisConfig {
@Value("${spring.data.redis.port}")
private int port;

@Value("${spring.data.redis.password}")
private String password;

@Bean
public RedisConnectionFactory redisConnectionFactory() {
return new LettuceConnectionFactory(host, port);
RedisStandaloneConfiguration redisConfiguration = new RedisStandaloneConfiguration(host, port);
redisConfiguration.setPassword(password);
return new LettuceConnectionFactory(redisConfiguration);
}

@Bean
Expand Down

0 comments on commit 4886e90

Please sign in to comment.