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-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-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-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-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 9b51f95..484c6dd 100644 --- a/zzansuni-api-server/app/src/main/resources/application.yml +++ b/zzansuni-api-server/app/src/main/resources/application.yml @@ -1,24 +1,12 @@ 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 - flyway: - enabled: false - h2: - console: - enabled: true - path: /h2-console + profiles: + include: + - flyway + - database + - jwt + - oauth2 + - s3 + - doc servlet: multipart: max-file-size: 5MB @@ -26,18 +14,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 - 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: @@ -51,74 +27,8 @@ 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 - flyway: - enabled: true - baseline-on-migrate: false # Flyway가 초기화되지 않은 데이터베이스에 마이그레이션을 적용할 때 초기 버전으로 마이그레이션 파일을 적용할지 여부 - fail-on-missing-locations: true # 스크립트 파일을 저장하는 위치를 못 찾을때 실패할지 여부 - baseline-version: 1 # Flyway가 초기화되지 않은 데이터베이스에 마이그레이션을 적용할 때 버전을 설정 server: tomcat: 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 - 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} -naver: - client-secret: ${NAVER_CLIENT_SECRET:placeholder} ---- -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} - credentials: - access-key: ${S3_ACCESS_KEY} - secret-key: ${S3_SECRET_KEY} - region: - 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 + min-spare: 10 # 최소 스레드 수 (기본값 10) \ No newline at end of file