Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chore] redis.yaml 파일로 config 관리 #55

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/main/java/team7/inplace/security/config/RedisConfig.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/application-redis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
redis:
db:
url: ${REDIS_DATABASE_URL}
port: ${REDIS_DATABASE_PORT}
1 change: 1 addition & 0 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]