Skip to content

Commit

Permalink
[BE-nathan] fix: db 접속정보가 보이는 문제 해결
Browse files Browse the repository at this point in the history
- properties를 여러개를 두어 spring.progiles.active로 관리
- logging 정보는 개발시 debug, 배포시 info로 설정
- 우선 mysql을 사용하여 개발토록하고, 유사시 h2를 활용
  • Loading branch information
nathan29849 committed Apr 9, 2022
1 parent a46da9b commit cf38130
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
4 changes: 4 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ out/

### VS Code ###
.vscode/

### db-connection
application-h2.properties
application-mysql.properties
2 changes: 1 addition & 1 deletion backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies {
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
runtimeOnly 'mysql:mysql-connector-java'
// runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.h2database:h2'
}

tasks.named('test') {
Expand Down
21 changes: 4 additions & 17 deletions backend/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
# do not set two of datasource.
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.driverClassName=org.h2.Driver

# In-Memory mode
#spring.datasource.url=jdbc:h2:mem:test;DB_CLOSE_ON_EXIT=FALSE
#spring.datasource.username=sa
#spring.datasource.password=

# aws mysql
spring.datasource.url=jdbc:mysql://ec2-15-165-159-189.ap-northeast-2.compute.amazonaws.com:3306/testdb?useSSL=false&useUnicode=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Seoul
spring.datasource.username=test
spring.datasource.password=team05

#spring.h2.console.enabled=true
#spring.h2.console.path=/h2-console

# profiles: h2, mysql
spring.profiles.active=mysql

#logging - develop: debug, production: info
logging.level.com.team05.todolist=debug

0 comments on commit cf38130

Please sign in to comment.