기존에 application.yml이 하나였는데 로컬, 운영으로 분리해보겠습니다.

application.yml
spring:
profiles:
active: local # 기본적으로 local 프로파일 사용 (운영에서는 prod로 변경)
jwt:
expiration_time: 86400000 # 1일
secret: jwt 시크릿키
application-local.yml
spring:
h2:
console:
enabled: true
path: /h2-console
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:mem:management
username: sa
password:
jpa:
hibernate:
ddl-auto: create
show-sql: true
database-platform: org.hibernate.dialect.H2Dialect
properties:
hibernate:
format_sql: true
로컬에서는 h2 데이터베이스를 바라보게 설정
application-prod.yml
spring:
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://호스트명:5432/데이터베이스명
username: 사용자명
password: 패스워드
jpa:
hibernate:
ddl-auto: create
show-sql: false
database-platform: org.hibernate.dialect.PostgreSQLDialect
properties:
hibernate:
format_sql: false
logging:
level:
org.hibernate.SQL: DEBUG # Hibernate 쿼리 로그 출력
운영에서는 postgres 데이터베이스를 바라보게 설정
build.gradle
implementation("org.postgresql:postgresql")
posgresql 의존성 추가