Skip to content

Commit

Permalink
fix:레디스 연결 방식 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondanythings committed Jul 6, 2024
1 parent 24da914 commit 86feddb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 0 additions & 8 deletions layer-api/infra/development/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
services:
redis:
image: redis:latest
container_name: redis
ports:
- "6379:6379"
networks:
- app-network

java-app:
image: ghcr.io/depromeet/kasukabe-server/layer-api:latest
container_name: layer-api
Expand Down
8 changes: 8 additions & 0 deletions layer-api/src/main/java/org/layer/config/RedisConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,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;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
Expand All @@ -20,8 +21,15 @@ public class RedisConfig {
@Value("${spring.data.redis.port}")
private int port;

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

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

Expand Down

0 comments on commit 86feddb

Please sign in to comment.