diff --git a/.gitignore b/.gitignore index 1483f90..3e10754 100644 --- a/.gitignore +++ b/.gitignore @@ -43,4 +43,4 @@ out/ .metadata/ settings.gradle - +application-*.yml diff --git a/src/main/java/com/acorn/AcornPrivateApplication.java b/src/main/java/com/acorn/ForklogBackendApplication.java similarity index 92% rename from src/main/java/com/acorn/AcornPrivateApplication.java rename to src/main/java/com/acorn/ForklogBackendApplication.java index b94437b..bd12c3e 100644 --- a/src/main/java/com/acorn/AcornPrivateApplication.java +++ b/src/main/java/com/acorn/ForklogBackendApplication.java @@ -20,10 +20,10 @@ @SpringBootApplication @EnableFeignClients(basePackages = "com.acorn.api.openfeign") @EnableSpringDataWebSupport(pageSerializationMode = PageSerializationMode.VIA_DTO) -public class AcornPrivateApplication { +public class ForklogBackendApplication { public static void main(String[] args) { - SpringApplication.run(AcornPrivateApplication.class, args); + SpringApplication.run(ForklogBackendApplication.class, args); } } diff --git a/src/main/java/com/acorn/api/openfeign/KakaoOpenFeignConfig.java b/src/main/java/com/acorn/api/openfeign/KakaoOpenFeignConfig.java index eb9b86a..b315f26 100644 --- a/src/main/java/com/acorn/api/openfeign/KakaoOpenFeignConfig.java +++ b/src/main/java/com/acorn/api/openfeign/KakaoOpenFeignConfig.java @@ -14,6 +14,9 @@ public class KakaoOpenFeignConfig { @Value("${kakao.rest_api_key}") private String kakaoApiKey; + @Value("${feign.logger.level}") + private Level feignLoggerLevel; + @Bean public RequestInterceptor kakaoRequestInterceptor() { return requestTemplate -> { @@ -23,13 +26,14 @@ public RequestInterceptor kakaoRequestInterceptor() { /** * Feign Logging을 위한 설정. + * feign.logger.level 환경 변수 값을 이용함. * * REST API 키가 이클립스 콘솔창에 노출되니 정말 필요할 때만 사용! * @author JeroCaller (JJH) */ @Bean public Logger.Level feignLoggerLevel() { - return Level.FULL; + return feignLoggerLevel; } } diff --git a/src/main/java/com/acorn/config/SecurityConfig.java b/src/main/java/com/acorn/config/SecurityConfig.java index 41a1135..680c182 100644 --- a/src/main/java/com/acorn/config/SecurityConfig.java +++ b/src/main/java/com/acorn/config/SecurityConfig.java @@ -5,6 +5,7 @@ import java.nio.file.Paths; import java.util.List; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; @@ -37,6 +38,9 @@ @RequiredArgsConstructor public class SecurityConfig implements WebMvcConfigurer { + @Value("${file.upload-dir}") + private String uploadBaseDir; + @Bean public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity, JwtAuthenticationFilter jwtAuthenticationFilter) throws Exception { // CORS 설정과 CSRF 비활성화, 세션 관리 정책 설정 @@ -84,7 +88,8 @@ public PasswordEncoder PasswordEncoder() { public void addResourceHandlers(ResourceHandlerRegistry registry) { //정적리소스(이미지,css,js,데이터 경로) 추가 설정 //지금은 업로드 경로 설정이 목적 - Path uploadDir = Paths.get("./uploads"); + //Path uploadDir = Paths.get("./uploads"); + Path uploadDir = Paths.get(uploadBaseDir); //uploads 절대 경로 얻기 String uploadPath = uploadDir.toFile().getAbsolutePath(); // /uploads/test.png라는 url이 들어오면 uploads디렉토리 내의 test.png를 반환 diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties deleted file mode 100644 index 1107109..0000000 --- a/src/main/resources/application.properties +++ /dev/null @@ -1,61 +0,0 @@ -spring.application.name=AcornPrivate - -# private 설정 파일 별도 분리 -spring.profiles.active=private - -# 지연로딩 설정 -spring.jpa.open-in-view=false - -server.port=8080 - -# jpa -spring.jpa.properties.hibernate.show_sql=true -spring.jpa.properties.hibernate.format_sql=false -spring.jpa.properties.hibernate.use_sql_comments=true -spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MariaDBDialect - -# feign configuration -spring.cloud.openfeign.httpclient.connection-timeout=5000 -spring.cloud.openfeign.httpclient.ok-http.read-timeout=5000 - -# security logging -logging.level.org.springframework.security=DEBUG -logging.level.org.springframework.web.cors=DEBUG - -# upload directory -file.upload-dir=./uploads -spring.servlet.multipart.enabled=true -spring.servlet.multipart.max-file-size=10MB -spring.servlet.multipart.max-request-size=10MB - -# mariadb server connect (cloudtype) -spring.datasource.driver-class-name=org.mariadb.jdbc.Driver -spring.datasource.url=${DB_URL} -spring.datasource.username=${DB_USERNAME} -spring.datasource.password=${DB_PASSWORD} - -# JWT SecretKey -secret-key=${JWT_SECRET_KEY} - -# kakao API -kakao.rest_api_key=${KAKAO_REST_API_KEY} -kakao.redirect_uri=${KAKAO_REDIRECT_URI} - -# naver API -naver.search.clientId=${NAVER_CLIENT_ID} -naver.search.clientSecret=${NAVER_CLIENT_SECRET} - -# GMail -spring.mail.host=smtp.gmail.com -spring.mail.port=587 -spring.mail.properties.mail.deug=true -spring.mail.properties.mail.smtp.auth=true -spring.mail.properties.mail.smtp.timeout=50000 -spring.mail.properties.mail.smtp.starttls.enable=true -spring.mail.properties.mail.smtp.starttls.required=true - -spring.mail.username=${MAIL_USERNAME} -spring.mail.password=${MAIL_PASSWORD} - -# react project path mapping -spring.web.resources.add-mappings=true diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..71e5686 --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,61 @@ +spring: + application: + name: forklog_backend + + profiles: + include: secret + # dev, prod + active: dev + + jpa: + # 지연로딩 설정 + open-in-view: false + properties: + hibernate: + show_sql: true + format_sql: false + use_sql_comments: true + dialect: org.hibernate.dialect.MariaDBDialect + + # feign configuration + cloud: + openfeign: + httpclient: + connection-timeout: 5000 + ok-http: + read-timeout: 5000 + + # file upload configuration + servlet: + multipart: + enabled: true + max-file-size: 10MB + max-request-size: 10MB + + web: + resources: + # react project path mapping + add-mappings: true + +server: + port: 8080 + +# security logging +logging: + level: + org: + springframework: + security: DEBUG + web: + cors: DEBUG + + # feign log + com: + acorn: + api: + openfeign: + KakaoRestOpenFeign: DEBUG + +# upload directory +file: + upload-dir: ./uploads \ No newline at end of file diff --git "a/uploads/184_\354\232\260\354\243\274\352\260\225\354\225\204\354\247\200.png" "b/uploads/184_\354\232\260\354\243\274\352\260\225\354\225\204\354\247\200.png" new file mode 100644 index 0000000..5869e9f Binary files /dev/null and "b/uploads/184_\354\232\260\354\243\274\352\260\225\354\225\204\354\247\200.png" differ diff --git "a/uploads/185_\354\232\260\354\243\274\352\260\225\354\225\204\354\247\200.png" "b/uploads/185_\354\232\260\354\243\274\352\260\225\354\225\204\354\247\200.png" new file mode 100644 index 0000000..5869e9f Binary files /dev/null and "b/uploads/185_\354\232\260\354\243\274\352\260\225\354\225\204\354\247\200.png" differ