diff --git a/.gitignore b/.gitignore index d2acdbd..c8789ca 100644 --- a/.gitignore +++ b/.gitignore @@ -36,11 +36,6 @@ out/ ### VS Code ### .vscode/ -### Application Config ### -application.yml -application-dev.yml -application-prod.yml -application-*.yml ### Docker & Environment ### .env diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml new file mode 100644 index 0000000..e8f640c --- /dev/null +++ b/src/main/resources/application-dev.yml @@ -0,0 +1,52 @@ +spring: + datasource: + url: jdbc:mysql://${DB_HOST}:${DB_PORT}/${DB_NAME}?useSSL=false&serverTimezone=Asia/Seoul&characterEncoding=UTF-8&allowPublicKeyRetrieval=true + username: ${DB_USERNAME} + password: ${DB_PASSWORD} + driver-class-name: com.mysql.cj.jdbc.Driver + + jpa: + hibernate: + ddl-auto: update + show-sql: true + + data: + redis: + host: ${REDIS_HOST} + port: ${REDIS_PORT} + + security: + oauth2: + client: + registration: + google: + client-id: ${GOOGLE_CLIENT_ID} + client-secret: ${GOOGLE_CLIENT_SECRET} + authorization-grant-type: authorization_code + scope: + - email + - profile + redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}" + naver: + client-id: ${NAVER_CLIENT_ID} + client-secret: ${NAVER_CLIENT_SECRET} + authorization-grant-type: authorization_code + scope: + - name + - email + - profile_image + redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}" + provider: + 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 + +server: + port: ${SERVER_PORT} + +jwt: + secret: ${JWT_SECRET} + access-token-expiration: 1800000 # 30분 (밀리초) + refresh-token-expiration: 604800000 # 7일 (밀리초) \ No newline at end of file diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml new file mode 100644 index 0000000..d8904e3 --- /dev/null +++ b/src/main/resources/application-prod.yml @@ -0,0 +1,33 @@ +spring: + datasource: + url: ${SPRING_DATASOURCE_URL} + username: ${MYSQL_USER} + password: ${MYSQL_PASSWORD} + driver-class-name: com.mysql.cj.jdbc.Driver + + jpa: + hibernate: + ddl-auto: ${SPRING_JPA_HIBERNATE_DDL_AUTO:update} # 운영에서도 테이블 자동 생성 + show-sql: ${SPRING_JPA_SHOW_SQL:false} # 운영에서는 SQL 로그 비활성화 + + data: + redis: + host: ${SPRING_DATA_REDIS_HOST:redis} # docker-compose의 redis 서비스명 + port: ${SPRING_DATA_REDIS_PORT:6379} + + security: + oauth2: + client: + registration: + google: + client-id: ${GOOGLE_CLIENT_ID} + client-secret: ${GOOGLE_CLIENT_SECRET} + scope: + - email + - profile + redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}" + +jwt: + secret: ${JWT_SECRET} + access-token-expiration: ${JWT_ACCESS_TOKEN_EXPIRATION:1800000} # 30분 + refresh-token-expiration: ${JWT_REFRESH_TOKEN_EXPIRATION:604800000} # 7일 \ No newline at end of file