From 96c89ef8a78ff15a81ce1d410ee3b5f409430274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=90=ED=99=8D=EC=84=9D?= <78216059+bayy1216@users.noreply.github.com> Date: Tue, 24 Sep 2024 14:44:13 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[Feat]:=20flyway=20yml=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/src/main/resources/application-flyway.yml | 13 +++++++++++++ .../app/src/main/resources/application.yml | 10 +++------- 2 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 zzansuni-api-server/app/src/main/resources/application-flyway.yml diff --git a/zzansuni-api-server/app/src/main/resources/application-flyway.yml b/zzansuni-api-server/app/src/main/resources/application-flyway.yml new file mode 100644 index 0000000..9019fa4 --- /dev/null +++ b/zzansuni-api-server/app/src/main/resources/application-flyway.yml @@ -0,0 +1,13 @@ +spring: + flyway: + enabled: false +--- +spring: + config: + activate: + on-profile: local, dev, prod + flyway: + enabled: true + baseline-on-migrate: false # Flyway가 초기화되지 않은 데이터베이스에 마이그레이션을 적용할 때 초기 버전으로 마이그레이션 파일을 적용할지 여부 + fail-on-missing-locations: true # 스크립트 파일을 저장하는 위치를 못 찾을때 실패할지 여부 + baseline-version: 1 # Flyway가 초기화되지 않은 데이터베이스에 마이그레이션을 적용할 때 버전을 설정 \ No newline at end of file diff --git a/zzansuni-api-server/app/src/main/resources/application.yml b/zzansuni-api-server/app/src/main/resources/application.yml index 9b51f95..f9ce802 100644 --- a/zzansuni-api-server/app/src/main/resources/application.yml +++ b/zzansuni-api-server/app/src/main/resources/application.yml @@ -1,4 +1,7 @@ spring: # default test profile + profiles: + include: + - flyway datasource: url: "jdbc:h2:mem:zzansuni;MODE=MySQL" username: "sa" @@ -13,8 +16,6 @@ spring: # default test profile hibernate: dialect: org.hibernate.dialect.H2Dialect sql.init.mode: never - flyway: - enabled: false h2: console: enabled: true @@ -62,11 +63,6 @@ spring: dialect: org.hibernate.dialect.MySQL8Dialect sql.init.mode: never h2.console.enabled: false - flyway: - enabled: true - baseline-on-migrate: false # Flyway가 초기화되지 않은 데이터베이스에 마이그레이션을 적용할 때 초기 버전으로 마이그레이션 파일을 적용할지 여부 - fail-on-missing-locations: true # 스크립트 파일을 저장하는 위치를 못 찾을때 실패할지 여부 - baseline-version: 1 # Flyway가 초기화되지 않은 데이터베이스에 마이그레이션을 적용할 때 버전을 설정 server: tomcat: threads: From c83a903457854422f8b158755a8b782294e130b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=90=ED=99=8D=EC=84=9D?= <78216059+bayy1216@users.noreply.github.com> Date: Tue, 24 Sep 2024 14:52:56 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[Feat]:=20db=20yml=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/application-database.yml | 63 +++++++++++++++++++ .../app/src/main/resources/application.yml | 48 +------------- 2 files changed, 64 insertions(+), 47 deletions(-) create mode 100644 zzansuni-api-server/app/src/main/resources/application-database.yml diff --git a/zzansuni-api-server/app/src/main/resources/application-database.yml b/zzansuni-api-server/app/src/main/resources/application-database.yml new file mode 100644 index 0000000..ea2145c --- /dev/null +++ b/zzansuni-api-server/app/src/main/resources/application-database.yml @@ -0,0 +1,63 @@ +spring: # default test profile + datasource: + url: "jdbc:h2:mem:zzansuni;MODE=MySQL" + username: "sa" + password: "" + driver-class-name: org.h2.Driver + jpa: + hibernate: + ddl-auto: create + naming: + physical-strategy: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy + properties: + hibernate: + dialect: org.hibernate.dialect.H2Dialect + sql.init.mode: never + h2: + console: + enabled: true + path: /h2-console +logging.level: + org.hibernate: + orm.jdbc.bind: trace + SQL: debug +--- +spring: + config: + activate: + on-profile: local, dev, prod # dev, prod 공통 설정 + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + jpa: + hibernate: + ddl-auto: none + defer-datasource-initialization: false + properties: + hibernate: + dialect: org.hibernate.dialect.MySQL8Dialect + sql.init.mode: never + h2.console.enabled: false +--- +spring: # local profile + config: + activate: + on-profile: local + datasource: + url: jdbc:mysql://localhost:3306/zzansuni?createDatabaseIfNotExist=true + username: "root" + password: "root" + jpa: + hibernate: + ddl-auto: none +--- +spring: # dev,prod profile + config: + activate: + on-profile: dev, prod + datasource: + url: ${MYSQL_URL} + username: ${MYSQL_USERNAME} + password: ${MYSQL_PASSWORD} + jpa: + hibernate: + ddl-auto: none \ No newline at end of file diff --git a/zzansuni-api-server/app/src/main/resources/application.yml b/zzansuni-api-server/app/src/main/resources/application.yml index f9ce802..9a868d4 100644 --- a/zzansuni-api-server/app/src/main/resources/application.yml +++ b/zzansuni-api-server/app/src/main/resources/application.yml @@ -2,24 +2,7 @@ spring: # default test profile profiles: include: - flyway - datasource: - url: "jdbc:h2:mem:zzansuni;MODE=MySQL" - username: "sa" - password: "" - driver-class-name: org.h2.Driver - jpa: - hibernate: - ddl-auto: create - naming: - physical-strategy: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy - properties: - hibernate: - dialect: org.hibernate.dialect.H2Dialect - sql.init.mode: never - h2: - console: - enabled: true - path: /h2-console + - database servlet: multipart: max-file-size: 5MB @@ -27,10 +10,6 @@ spring: # default test profile resolve-lazily: true # 파일 업로드 시점에 메모리에 저장 lifecycle: timeout-per-shutdown-phase: 15s # 스프링이 종료될때 모든 작업이 종료될때 까지 기다리는 시간 -logging.level: - org.hibernate: - orm.jdbc.bind: trace - SQL: debug springdoc: default-consumes-media-type: application/json;charset=UTF-8 default-produces-media-type: application/json;charset=UTF-8 @@ -52,17 +31,6 @@ spring: config: activate: on-profile: local, dev, prod # dev, prod 공통 설정 - datasource: - driver-class-name: com.mysql.cj.jdbc.Driver - jpa: - hibernate: - ddl-auto: none - defer-datasource-initialization: false - properties: - hibernate: - dialect: org.hibernate.dialect.MySQL8Dialect - sql.init.mode: never - h2.console.enabled: false server: tomcat: threads: @@ -77,13 +45,6 @@ spring: # local profile config: activate: on-profile: local - datasource: - url: jdbc:mysql://localhost:3306/zzansuni?createDatabaseIfNotExist=true - username: "root" - password: "root" - jpa: - hibernate: - ddl-auto: none kakao: client-secret: ${KAKAO_CLIENT_SECRET:placeholder} redirect-uri: ${KAKAO_REDIRECT_URI:placeholder} @@ -94,13 +55,6 @@ spring: # dev,prod profile config: activate: on-profile: dev, prod - datasource: - url: ${MYSQL_URL} - username: ${MYSQL_USERNAME} - password: ${MYSQL_PASSWORD} - jpa: - hibernate: - ddl-auto: none cloud: aws: s3.bucket: ${S3_BUCKET} From 2b9d15e57a0ac7f2a2591b281cef9481e2f55e51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=90=ED=99=8D=EC=84=9D?= <78216059+bayy1216@users.noreply.github.com> Date: Tue, 24 Sep 2024 14:55:45 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[Feat]:=20=EC=9D=B8=EC=A6=9D=20yml=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-jwt.yml | 4 +++ .../src/main/resources/application-oauth2.yml | 29 +++++++++++++++++++ .../app/src/main/resources/application.yml | 28 ++---------------- 3 files changed, 36 insertions(+), 25 deletions(-) create mode 100644 zzansuni-api-server/app/src/main/resources/application-jwt.yml create mode 100644 zzansuni-api-server/app/src/main/resources/application-oauth2.yml diff --git a/zzansuni-api-server/app/src/main/resources/application-jwt.yml b/zzansuni-api-server/app/src/main/resources/application-jwt.yml new file mode 100644 index 0000000..a08e785 --- /dev/null +++ b/zzansuni-api-server/app/src/main/resources/application-jwt.yml @@ -0,0 +1,4 @@ +jwt: + secret: ${JWT_SECRET:4099a46b-39db-4860-a61b-2ae76ea24c43} + access-token-expire-time: 1800000 # 30 minutes + refresh-token-expire-time: 2592000000 # 30 days \ No newline at end of file diff --git a/zzansuni-api-server/app/src/main/resources/application-oauth2.yml b/zzansuni-api-server/app/src/main/resources/application-oauth2.yml new file mode 100644 index 0000000..490dea5 --- /dev/null +++ b/zzansuni-api-server/app/src/main/resources/application-oauth2.yml @@ -0,0 +1,29 @@ +spring: + config: + activate: + on-profile: local, dev, prod # dev, prod 공통 설정 +kakao: + client-id: ${KAKAO_CLIENT_ID:c959f4526a0df321dff0a8636fec3428} +naver: + client-id: ${NAVER_CLIENT_ID:Ob2i2TZtIsaNqH8j_q9X} +--- +spring: # local profile + config: + activate: + on-profile: local +kakao: + client-secret: ${KAKAO_CLIENT_SECRET:placeholder} + redirect-uri: ${KAKAO_REDIRECT_URI:placeholder} +naver: + client-secret: ${NAVER_CLIENT_SECRET:placeholder} +--- +spring: # dev,prod profile + config: + activate: + on-profile: dev, prod +kakao: + client-secret: ${KAKAO_CLIENT_SECRET} + redirect-uri: ${KAKAO_REDIRECT_URI} +naver: + client-secret: ${NAVER_CLIENT_SECRET} +server-url: ${SERVER_URL} \ No newline at end of file diff --git a/zzansuni-api-server/app/src/main/resources/application.yml b/zzansuni-api-server/app/src/main/resources/application.yml index 9a868d4..874064a 100644 --- a/zzansuni-api-server/app/src/main/resources/application.yml +++ b/zzansuni-api-server/app/src/main/resources/application.yml @@ -3,6 +3,8 @@ spring: # default test profile include: - flyway - database + - jwt + - oauth2 servlet: multipart: max-file-size: 5MB @@ -14,10 +16,6 @@ springdoc: default-consumes-media-type: application/json;charset=UTF-8 default-produces-media-type: application/json;charset=UTF-8 use-fqn: true # 패키지 경로를 포함한 클래스명으로 문서화 (FOR inner static class) -jwt: - secret: ${JWT_SECRET:4099a46b-39db-4860-a61b-2ae76ea24c43} - access-token-expire-time: 1800000 # 30 minutes - refresh-token-expire-time: 2592000000 # 30 days server: shutdown: graceful tomcat: @@ -36,20 +34,6 @@ server: threads: max: 200 # 최대 스레드 수 (기본값 200) min-spare: 10 # 최소 스레드 수 (기본값 10) -kakao: - client-id: ${KAKAO_CLIENT_ID:c959f4526a0df321dff0a8636fec3428} -naver: - client-id: ${NAVER_CLIENT_ID:Ob2i2TZtIsaNqH8j_q9X} ---- -spring: # local profile - config: - activate: - on-profile: local -kakao: - client-secret: ${KAKAO_CLIENT_SECRET:placeholder} - redirect-uri: ${KAKAO_REDIRECT_URI:placeholder} -naver: - client-secret: ${NAVER_CLIENT_SECRET:placeholder} --- spring: # dev,prod profile config: @@ -65,10 +49,4 @@ cloud: static: ap-northeast-2 auto: false stack: - auto: false -kakao: - client-secret: ${KAKAO_CLIENT_SECRET} - redirect-uri: ${KAKAO_REDIRECT_URI} -naver: - client-secret: ${NAVER_CLIENT_SECRET} -server-url: ${SERVER_URL} \ No newline at end of file + auto: false \ No newline at end of file From e953690c2025ab8d01edf7a418107b19a8b6e7c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=90=ED=99=8D=EC=84=9D?= <78216059+bayy1216@users.noreply.github.com> Date: Tue, 24 Sep 2024 14:58:01 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[Feat]:=20s3,=20doc=20yml=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-doc.yml | 10 ++++++++ .../app/src/main/resources/application-s3.yml | 15 ++++++++++++ .../app/src/main/resources/application.yml | 24 +++---------------- 3 files changed, 28 insertions(+), 21 deletions(-) create mode 100644 zzansuni-api-server/app/src/main/resources/application-doc.yml create mode 100644 zzansuni-api-server/app/src/main/resources/application-s3.yml diff --git a/zzansuni-api-server/app/src/main/resources/application-doc.yml b/zzansuni-api-server/app/src/main/resources/application-doc.yml new file mode 100644 index 0000000..bf6ac40 --- /dev/null +++ b/zzansuni-api-server/app/src/main/resources/application-doc.yml @@ -0,0 +1,10 @@ +springdoc: + default-consumes-media-type: application/json;charset=UTF-8 + default-produces-media-type: application/json;charset=UTF-8 + use-fqn: true # 패키지 경로를 포함한 클래스명으로 문서화 (FOR inner static class) +--- +spring: # dev,prod profile + config: + activate: + on-profile: dev, prod +server-url: ${SERVER_URL} \ No newline at end of file diff --git a/zzansuni-api-server/app/src/main/resources/application-s3.yml b/zzansuni-api-server/app/src/main/resources/application-s3.yml new file mode 100644 index 0000000..b168cab --- /dev/null +++ b/zzansuni-api-server/app/src/main/resources/application-s3.yml @@ -0,0 +1,15 @@ +spring: # dev,prod profile + config: + activate: + on-profile: dev, prod +cloud: + aws: + s3.bucket: ${S3_BUCKET} + credentials: + access-key: ${S3_ACCESS_KEY} + secret-key: ${S3_SECRET_KEY} + region: + static: ap-northeast-2 + auto: false + stack: + auto: false \ No newline at end of file diff --git a/zzansuni-api-server/app/src/main/resources/application.yml b/zzansuni-api-server/app/src/main/resources/application.yml index 874064a..484c6dd 100644 --- a/zzansuni-api-server/app/src/main/resources/application.yml +++ b/zzansuni-api-server/app/src/main/resources/application.yml @@ -5,6 +5,8 @@ spring: # default test profile - database - jwt - oauth2 + - s3 + - doc servlet: multipart: max-file-size: 5MB @@ -12,10 +14,6 @@ spring: # default test profile resolve-lazily: true # 파일 업로드 시점에 메모리에 저장 lifecycle: timeout-per-shutdown-phase: 15s # 스프링이 종료될때 모든 작업이 종료될때 까지 기다리는 시간 -springdoc: - default-consumes-media-type: application/json;charset=UTF-8 - default-produces-media-type: application/json;charset=UTF-8 - use-fqn: true # 패키지 경로를 포함한 클래스명으로 문서화 (FOR inner static class) server: shutdown: graceful tomcat: @@ -33,20 +31,4 @@ server: tomcat: threads: max: 200 # 최대 스레드 수 (기본값 200) - min-spare: 10 # 최소 스레드 수 (기본값 10) ---- -spring: # dev,prod profile - config: - activate: - on-profile: dev, prod -cloud: - aws: - s3.bucket: ${S3_BUCKET} - credentials: - access-key: ${S3_ACCESS_KEY} - secret-key: ${S3_SECRET_KEY} - region: - static: ap-northeast-2 - auto: false - stack: - auto: false \ No newline at end of file + min-spare: 10 # 최소 스레드 수 (기본값 10) \ No newline at end of file