store register add
This commit is contained in:
@@ -1,102 +1,102 @@
|
||||
package com.ktds.hi.common.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.CorsConfigurationSource;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 전체 서비스 통합 CORS 설정 클래스
|
||||
* 모든 마이크로서비스에서 공통으로 사용되는 CORS 정책을 정의
|
||||
*/
|
||||
@Configuration
|
||||
public class CorsConfig implements WebMvcConfigurer {
|
||||
|
||||
@Value("${app.cors.allowed-origins:http://20.214.126.84,http://localhost:3000}")
|
||||
private String allowedOrigins;
|
||||
|
||||
@Value("${app.cors.allowed-methods:GET,POST,PUT,DELETE,OPTIONS}")
|
||||
private String allowedMethods;
|
||||
|
||||
@Value("${app.cors.allowed-headers:*}")
|
||||
private String allowedHeaders;
|
||||
|
||||
@Value("${app.cors.exposed-headers:Authorization,X-Total-Count}")
|
||||
private String exposedHeaders;
|
||||
|
||||
@Value("${app.cors.allow-credentials:true}")
|
||||
private boolean allowCredentials;
|
||||
|
||||
@Value("${app.cors.max-age:3600}")
|
||||
private long maxAge;
|
||||
|
||||
/**
|
||||
* WebMvcConfigurer를 통한 CORS 설정
|
||||
*/
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**")
|
||||
.allowedOriginPatterns(allowedOrigins.split(","))
|
||||
.allowedMethods(allowedMethods.split(","))
|
||||
.allowedHeaders(allowedHeaders.split(","))
|
||||
.exposedHeaders(exposedHeaders.split(","))
|
||||
.allowCredentials(allowCredentials)
|
||||
.maxAge(maxAge);
|
||||
}
|
||||
|
||||
/**
|
||||
* CorsConfigurationSource Bean 생성
|
||||
* Spring Security와 함께 사용되는 CORS 설정
|
||||
*/
|
||||
@Bean
|
||||
public CorsConfigurationSource corsConfigurationSource() {
|
||||
CorsConfiguration configuration = new CorsConfiguration();
|
||||
|
||||
// Origin 설정
|
||||
List<String> origins = Arrays.asList(allowedOrigins.split(","));
|
||||
configuration.setAllowedOriginPatterns(origins);
|
||||
|
||||
// Method 설정
|
||||
List<String> methods = Arrays.asList(allowedMethods.split(","));
|
||||
configuration.setAllowedMethods(methods);
|
||||
|
||||
// Header 설정
|
||||
if ("*".equals(allowedHeaders)) {
|
||||
configuration.addAllowedHeader("*");
|
||||
} else {
|
||||
List<String> headers = Arrays.asList(allowedHeaders.split(","));
|
||||
configuration.setAllowedHeaders(headers);
|
||||
}
|
||||
|
||||
// Exposed Headers 설정
|
||||
List<String> exposed = Arrays.asList(exposedHeaders.split(","));
|
||||
configuration.setExposedHeaders(exposed);
|
||||
|
||||
// Credentials 설정
|
||||
configuration.setAllowCredentials(allowCredentials);
|
||||
|
||||
// Max Age 설정
|
||||
configuration.setMaxAge(maxAge);
|
||||
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
source.registerCorsConfiguration("/**", configuration);
|
||||
return source;
|
||||
}
|
||||
|
||||
/**
|
||||
* CorsFilter Bean 생성
|
||||
* 글로벌 CORS 필터로 사용
|
||||
*/
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
return new CorsFilter(corsConfigurationSource());
|
||||
}
|
||||
package com.ktds.hi.common.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.CorsConfigurationSource;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 전체 서비스 통합 CORS 설정 클래스
|
||||
* 모든 마이크로서비스에서 공통으로 사용되는 CORS 정책을 정의
|
||||
*/
|
||||
@Configuration
|
||||
public class CorsConfig implements WebMvcConfigurer {
|
||||
|
||||
@Value("${app.cors.allowed-origins:http://20.214.126.84,http://localhost:3000}")
|
||||
private String allowedOrigins;
|
||||
|
||||
@Value("${app.cors.allowed-methods:GET,POST,PUT,DELETE,OPTIONS}")
|
||||
private String allowedMethods;
|
||||
|
||||
@Value("${app.cors.allowed-headers:*}")
|
||||
private String allowedHeaders;
|
||||
|
||||
@Value("${app.cors.exposed-headers:Authorization,X-Total-Count}")
|
||||
private String exposedHeaders;
|
||||
|
||||
@Value("${app.cors.allow-credentials:true}")
|
||||
private boolean allowCredentials;
|
||||
|
||||
@Value("${app.cors.max-age:3600}")
|
||||
private long maxAge;
|
||||
|
||||
/**
|
||||
* WebMvcConfigurer를 통한 CORS 설정
|
||||
*/
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**")
|
||||
.allowedOriginPatterns(allowedOrigins.split(","))
|
||||
.allowedMethods(allowedMethods.split(","))
|
||||
.allowedHeaders(allowedHeaders.split(","))
|
||||
.exposedHeaders(exposedHeaders.split(","))
|
||||
.allowCredentials(allowCredentials)
|
||||
.maxAge(maxAge);
|
||||
}
|
||||
|
||||
/**
|
||||
* CorsConfigurationSource Bean 생성
|
||||
* Spring Security와 함께 사용되는 CORS 설정
|
||||
*/
|
||||
@Bean
|
||||
public CorsConfigurationSource corsConfigurationSource() {
|
||||
CorsConfiguration configuration = new CorsConfiguration();
|
||||
|
||||
// Origin 설정
|
||||
List<String> origins = Arrays.asList(allowedOrigins.split(","));
|
||||
configuration.setAllowedOriginPatterns(origins);
|
||||
|
||||
// Method 설정
|
||||
List<String> methods = Arrays.asList(allowedMethods.split(","));
|
||||
configuration.setAllowedMethods(methods);
|
||||
|
||||
// Header 설정
|
||||
if ("*".equals(allowedHeaders)) {
|
||||
configuration.addAllowedHeader("*");
|
||||
} else {
|
||||
List<String> headers = Arrays.asList(allowedHeaders.split(","));
|
||||
configuration.setAllowedHeaders(headers);
|
||||
}
|
||||
|
||||
// Exposed Headers 설정
|
||||
List<String> exposed = Arrays.asList(exposedHeaders.split(","));
|
||||
configuration.setExposedHeaders(exposed);
|
||||
|
||||
// Credentials 설정
|
||||
configuration.setAllowCredentials(allowCredentials);
|
||||
|
||||
// Max Age 설정
|
||||
configuration.setMaxAge(maxAge);
|
||||
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
source.registerCorsConfiguration("/**", configuration);
|
||||
return source;
|
||||
}
|
||||
|
||||
/**
|
||||
* CorsFilter Bean 생성
|
||||
* 글로벌 CORS 필터로 사용
|
||||
*/
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
return new CorsFilter(corsConfigurationSource());
|
||||
}
|
||||
}
|
||||
@@ -1,93 +1,93 @@
|
||||
spring:
|
||||
# JPA 설정
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: ${JPA_DDL_AUTO:update}
|
||||
naming:
|
||||
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
|
||||
implicit-strategy: org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
|
||||
show-sql: ${JPA_SHOW_SQL:false}
|
||||
properties:
|
||||
hibernate:
|
||||
format_sql: true
|
||||
use_sql_comments: true
|
||||
jdbc:
|
||||
batch_size: 20
|
||||
order_inserts: true
|
||||
order_updates: true
|
||||
batch_versioned_data: true
|
||||
|
||||
# Redis 설정
|
||||
data:
|
||||
redis:
|
||||
host: ${REDIS_HOST:localhost}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PASSWORD:}
|
||||
timeout: 2000ms
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 8
|
||||
max-wait: -1ms
|
||||
max-idle: 8
|
||||
min-idle: 0
|
||||
|
||||
# Jackson 설정
|
||||
jackson:
|
||||
time-zone: Asia/Seoul
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
serialization:
|
||||
write-dates-as-timestamps: false
|
||||
deserialization:
|
||||
fail-on-unknown-properties: false
|
||||
|
||||
# 트랜잭션 설정
|
||||
transaction:
|
||||
default-timeout: 30
|
||||
|
||||
# 애플리케이션 설정
|
||||
app:
|
||||
# JWT 설정
|
||||
jwt:
|
||||
secret-key: ${JWT_SECRET_KEY:hiorder-secret-key-for-jwt-token-generation-2024-very-long-secret-key}
|
||||
access-token-validity: ${JWT_ACCESS_TOKEN_VALIDITY:3600000} # 1시간
|
||||
refresh-token-validity: ${JWT_REFRESH_TOKEN_VALIDITY:604800000} # 7일
|
||||
# CORS 설정
|
||||
cors:
|
||||
allowed-origins: ${CORS_ALLOWED_ORIGINS:http://20.214.126.84,http://localhost:8080}
|
||||
allowed-methods: ${CORS_ALLOWED_METHODS:GET,POST,PUT,DELETE,OPTIONS}
|
||||
allowed-headers: ${CORS_ALLOWED_HEADERS:*}
|
||||
exposed-headers: ${CORS_EXPOSED_HEADERS:Authorization, X-Total-Count}
|
||||
allow-credentials: ${CORS_ALLOW_CREDENTIALS:true}
|
||||
max-age: ${CORS_MAX_AGE:3600}
|
||||
|
||||
# 캐시 설정
|
||||
cache:
|
||||
default-ttl: ${CACHE_DEFAULT_TTL:3600} # 1시간
|
||||
|
||||
# Swagger 설정
|
||||
swagger:
|
||||
title: ${SWAGGER_TITLE:하이오더 API}
|
||||
description: ${SWAGGER_DESCRIPTION:하이오더 백엔드 API 문서}
|
||||
version: ${SWAGGER_VERSION:1.0.0}
|
||||
server-url: ${SWAGGER_SERVER_URL:http://localhost:8080}
|
||||
|
||||
# 로깅 설정
|
||||
logging:
|
||||
level:
|
||||
com.ktds.hi: ${LOG_LEVEL:INFO}
|
||||
org.springframework.security: ${SECURITY_LOG_LEVEL:INFO}
|
||||
org.hibernate.SQL: ${SQL_LOG_LEVEL:INFO}
|
||||
org.hibernate.type.descriptor.sql.BasicBinder: ${SQL_PARAM_LOG_LEVEL:INFO}
|
||||
pattern:
|
||||
console: "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
|
||||
file: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
|
||||
|
||||
# 관리 엔드포인트 설정
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info,metrics,prometheus
|
||||
endpoint:
|
||||
health:
|
||||
show-details: when-authorized
|
||||
spring:
|
||||
# JPA 설정
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: ${JPA_DDL_AUTO:update}
|
||||
naming:
|
||||
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
|
||||
implicit-strategy: org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
|
||||
show-sql: ${JPA_SHOW_SQL:false}
|
||||
properties:
|
||||
hibernate:
|
||||
format_sql: true
|
||||
use_sql_comments: true
|
||||
jdbc:
|
||||
batch_size: 20
|
||||
order_inserts: true
|
||||
order_updates: true
|
||||
batch_versioned_data: true
|
||||
|
||||
# Redis 설정
|
||||
data:
|
||||
redis:
|
||||
host: ${REDIS_HOST:localhost}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PASSWORD:}
|
||||
timeout: 2000ms
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 8
|
||||
max-wait: -1ms
|
||||
max-idle: 8
|
||||
min-idle: 0
|
||||
|
||||
# Jackson 설정
|
||||
jackson:
|
||||
time-zone: Asia/Seoul
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
serialization:
|
||||
write-dates-as-timestamps: false
|
||||
deserialization:
|
||||
fail-on-unknown-properties: false
|
||||
|
||||
# 트랜잭션 설정
|
||||
transaction:
|
||||
default-timeout: 30
|
||||
|
||||
# 애플리케이션 설정
|
||||
app:
|
||||
# JWT 설정
|
||||
jwt:
|
||||
secret-key: ${JWT_SECRET_KEY:hiorder-secret-key-for-jwt-token-generation-2024-very-long-secret-key}
|
||||
access-token-validity: ${JWT_ACCESS_TOKEN_VALIDITY:3600000} # 1시간
|
||||
refresh-token-validity: ${JWT_REFRESH_TOKEN_VALIDITY:604800000} # 7일
|
||||
# CORS 설정
|
||||
cors:
|
||||
allowed-origins: ${CORS_ALLOWED_ORIGINS:http://20.214.126.84,http://localhost:8080}
|
||||
allowed-methods: ${CORS_ALLOWED_METHODS:GET,POST,PUT,DELETE,OPTIONS}
|
||||
allowed-headers: ${CORS_ALLOWED_HEADERS:*}
|
||||
exposed-headers: ${CORS_EXPOSED_HEADERS:Authorization, X-Total-Count}
|
||||
allow-credentials: ${CORS_ALLOW_CREDENTIALS:true}
|
||||
max-age: ${CORS_MAX_AGE:3600}
|
||||
|
||||
# 캐시 설정
|
||||
cache:
|
||||
default-ttl: ${CACHE_DEFAULT_TTL:3600} # 1시간
|
||||
|
||||
# Swagger 설정
|
||||
swagger:
|
||||
title: ${SWAGGER_TITLE:하이오더 API}
|
||||
description: ${SWAGGER_DESCRIPTION:하이오더 백엔드 API 문서}
|
||||
version: ${SWAGGER_VERSION:1.0.0}
|
||||
server-url: ${SWAGGER_SERVER_URL:http://localhost:8080}
|
||||
|
||||
# 로깅 설정
|
||||
logging:
|
||||
level:
|
||||
com.ktds.hi: ${LOG_LEVEL:INFO}
|
||||
org.springframework.security: ${SECURITY_LOG_LEVEL:INFO}
|
||||
org.hibernate.SQL: ${SQL_LOG_LEVEL:INFO}
|
||||
org.hibernate.type.descriptor.sql.BasicBinder: ${SQL_PARAM_LOG_LEVEL:INFO}
|
||||
pattern:
|
||||
console: "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
|
||||
file: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"
|
||||
|
||||
# 관리 엔드포인트 설정
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info,metrics,prometheus
|
||||
endpoint:
|
||||
health:
|
||||
show-details: when-authorized
|
||||
|
||||
Reference in New Issue
Block a user