diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml index 2188214..b508f85 100644 --- a/.github/workflows/backend-ci.yml +++ b/.github/workflows/backend-ci.yml @@ -26,7 +26,7 @@ jobs: test: name: Unit and integration tests runs-on: ubuntu-latest - # application-dev.yml이 요구하는 값. CI에는 .env가 없으므로 더미 값을 주입한다(JWT는 32바이트 이상). + # application.yml이 요구하는 값. CI에는 .env가 없으므로 더미 값을 주입한다(JWT는 32바이트 이상). env: GOOGLE_CLIENT_ID: ci-dummy GOOGLE_CLIENT_SECRET: ci-dummy diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 6ebb216..43dd59c 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -1,50 +1,9 @@ +# 로컬 개발용. 서버(dev·prod)에서는 application-server.yml과 환경 변수가 이 값을 덮는다. spring: - sql: - init: - mode: never datasource: url: jdbc:postgresql://localhost:5678/database username: user password: password - driver-class-name: org.postgresql.Driver - jpa: - hibernate: - ddl-auto: validate - properties: - hibernate: - dialect: org.hibernate.dialect.PostgreSQLDialect - security: - oauth2: - client: - registration: - google: - client-id: ${GOOGLE_CLIENT_ID} - client-secret: ${GOOGLE_CLIENT_SECRET} - scope: - - email - - profile - kakao: - client-id: ${KAKAO_CLIENT_ID} - client-secret: ${KAKAO_CLIENT_SECRET} - redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}" - authorization-grant-type: authorization_code - client-authentication-method: client_secret_post - client-name: Kakao - scope: - - profile_nickname - provider: - # 카카오 제공자 서버 정보 추가 - kakao: - authorization-uri: https://kauth.kakao.com/oauth/authorize - token-uri: https://kauth.kakao.com/oauth/token - user-info-uri: https://kapi.kakao.com/v2/user/me - user-name-attribute: id - -jwt: - expiration: 600 - refresh_expiration: 86400 - secret: ${JWT_SECRET} - app: frontend: @@ -52,6 +11,3 @@ app: cookie: secure: false same-site: Lax - oauth2: - success-redirect-url: "/" - failure-redirect-url: "/login-error" diff --git a/src/main/resources/application-server.yml b/src/main/resources/application-server.yml new file mode 100644 index 0000000..fbf1ca2 --- /dev/null +++ b/src/main/resources/application-server.yml @@ -0,0 +1,11 @@ +# 배포 서버 공통(deploy/docker-compose.yml). dev 서버는 dev,server, 운영은 server 로 띄운다. +# DB 접속 정보는 SPRING_DATASOURCE_URL/USERNAME/PASSWORD 환경 변수로 받는다. +server: + forward-headers-strategy: framework # nginx 뒤에서 https 리다이렉트 URL을 만들기 위해 + +app: + frontend: + url: ${FRONTEND_URL} + cookie: + secure: true + same-site: None diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index c80a8db..2b70a2e 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -8,3 +8,50 @@ spring: flyway: baseline-on-migrate: true baseline-version: 2 + sql: + init: + mode: never + datasource: + driver-class-name: org.postgresql.Driver + jpa: + hibernate: + ddl-auto: validate + properties: + hibernate: + dialect: org.hibernate.dialect.PostgreSQLDialect + security: + oauth2: + client: + registration: + google: + client-id: ${GOOGLE_CLIENT_ID} + client-secret: ${GOOGLE_CLIENT_SECRET} + scope: + - email + - profile + kakao: + client-id: ${KAKAO_CLIENT_ID} + client-secret: ${KAKAO_CLIENT_SECRET} + redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}" + authorization-grant-type: authorization_code + client-authentication-method: client_secret_post + client-name: Kakao + scope: + - profile_nickname + provider: + # 카카오 제공자 서버 정보 추가 + kakao: + authorization-uri: https://kauth.kakao.com/oauth/authorize + token-uri: https://kauth.kakao.com/oauth/token + user-info-uri: https://kapi.kakao.com/v2/user/me + user-name-attribute: id + +jwt: + expiration: 600 + refresh_expiration: 86400 + secret: ${JWT_SECRET} + +app: + oauth2: + success-redirect-url: "/" + failure-redirect-url: "/login-error"