기존에 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 의존성 추가
'backend > 코프링' 카테고리의 다른 글
[코프링] 12. Render 무료 호스팅서버에 Spring boot + Kotlin 배포하기 (1) | 2025.02.14 |
---|---|
[코프링] 11. Render 무료 호스팅서버 Postgres 데이터베이스 생성 (0) | 2025.02.14 |
[코프링] 9. Spring Kotlin Jpa Querydsl Security Jwt 적용 (1) | 2025.02.11 |
[코프링] 8. Companion Object - 팩토리 메서드 패턴 설정 (0) | 2025.02.10 |
[코프링] Kotlin Spring Boot Api에서 파라미터 not null, null 체크 (0) | 2025.02.10 |