Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
*-local.yml

### STS ###
.apt_generated
Expand Down
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM eclipse-temurin:21-jre
WORKDIR /app

RUN useradd -m appuser
USER appuser

COPY build/libs/*.jar app.jar

EXPOSE 8080
ENV JAVA_OPTS=""
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/app.jar"]
58 changes: 58 additions & 0 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
spring:
config:
activate:
on-profile: prod

datasource:
#TODO:도메인 이름 변경
url: jdbc:mysql://plog-mysql:3306/plog?useSSL=false&allowPublicKeyRetrieval=true&characterEncoding=UTF-8&serverTimezone=Asia/Seoul
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: com.mysql.cj.jdbc.Driver

jpa:
database-platform: org.hibernate.dialect.MySQL8Dialect
hibernate:
ddl-auto: update
defer-datasource-initialization: false

security:
oauth2:
client:
registration:
kakao:
client-id: ${KAKAO_CLIENT_ID}
client-secret: ${KAKAO_CLIENT_SECRET}
client-authentication-method: client_secret_post
authorization-grant-type: authorization_code
redirect-uri: "https://your-domain.com/oauth/callback/kakao"
scope:
- profile_nickname
- profile_image
- account_email
client-name: Kakao

naver:
client-id: ${NAVER_CLIENT_ID}
client-secret: ${NAVER_CLIENT_SECRET}
client-authentication-method: client_secret_post
authorization-grant-type: authorization_code
redirect-uri: "https://your-domain.com/oauth/callback/naver"
scope:
- name
- email
- profile_image
client-name: Naver

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

naver:
authorization-uri: https://nid.naver.com/oauth2.0/authorize
token-uri: https://nid.naver.com/oauth2.0/token
user-info-uri: https://openapi.naver.com/v1/nid/me
user-name-attribute: response
73 changes: 1 addition & 72 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,82 +1,11 @@
spring:
datasource:
# [H2 Configuration] >> TODO : 배포 시 제거하거나 프로필 분리(local/prod) 필요
url: jdbc:h2:mem:progbe;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
username: sa
password:
driver-class-name: org.h2.Driver

# [MySQL Configurations] >> TODO : 실제 DB 연결 시 주석 해제 및 환경변수 설정 확인
# url: jdbc:mysql://localhost:3306/progbe?useSSL=false&characterEncoding=UTF-8&serverTimezone=UTC
# username: ${DB_USERNAME}
# password: ${DB_PASSWORD}
# driver-class-name: com.mysql.cj.jdbc.Driver

jpa:
# TODO: MySQL로 마이그레이션 시 수정
database-platform: org.hibernate.dialect.H2Dialect
hibernate:
# TODO: 배포 시 Validate | None으로 수정 - 혹은 프로필 분리(local/prod)
ddl-auto: update
properties:
hibernate:
format_sql: true
show_sql: true
# H2 Console (http://localhost:8080/h2-console)
defer-datasource-initialization: true

h2:
console:
enabled: true
path: /h2-console

security:
oauth2:
client:
registration:
kakao:
client-id: ${KAKAO_CLIENT_ID}
client-secret: ${KAKAO_CLIENT_SECRET}
client-authentication-method: client_secret_post
authorization-grant-type: authorization_code
# TODO: 프론트에서 등록한 redirect-uri 확인 (사용 안해도 정책 상 필요)
redirect-uri: "http://localhost:3000/oauth/callback/kakao"
scope:
- profile_nickname
- profile_image
- account_email
client-name: Kakao

naver:
client-id: ${NAVER_CLIENT_ID}
client-secret: ${NAVER_CLIENT_SECRET}
client-authentication-method: client_secret_post
authorization-grant-type: authorization_code
# TODO: 프론트에서 등록한 redirect-uri 확인 (사용 안해도 정책 상 필요)
redirect-uri: "http://localhost:3000/oauth/callback/naver"
scope:
- name
- email
- profile_image
client-name: Naver

# FIXME: AuthService가 아래 Provider 쓰도록
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

naver:
authorization-uri: https://nid.naver.com/oauth2.0/authorize
token-uri: https://nid.naver.com/oauth2.0/token
user-info-uri: https://openapi.naver.com/v1/nid/me
user-name-attribute: response

jwt:
secret: ${JWT_SECRET_KEY}
# Access Token = 30분
access-expiration: 1800000
# Refresh Token = 2주
refresh-expiration: 1209600000
refresh-expiration: 1209600000