Skip to content

Commit

Permalink
chore: update application.yaml file to use new db with env var
Browse files Browse the repository at this point in the history
  • Loading branch information
junglesub committed Jul 22, 2024
1 parent 106962f commit f0074cb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DB_HOST=
DB_NAME=
DB_USERNAME=
DB_PASSWORD=
DB_CLASSNAME=
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.env

.DS_Store
static/

Expand Down
8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
//db
runtimeOnly 'com.mysql:mysql-connector-j'
implementation 'org.mariadb.jdbc:mariadb-java-client:3.1.2'
// 추가 종료

compileOnly 'org.projectlombok:lombok'
Expand All @@ -47,7 +48,8 @@ def frontendDir = "$projectDir/src/main/front"

sourceSets {
main {
resources { srcDirs = ["$projectDir/src/main/resources"]
resources {
srcDirs = ["$projectDir/src/main/resources"]
}
}
}
Expand All @@ -60,8 +62,8 @@ task installReact(type: Exec) {
group = BasePlugin.BUILD_GROUP
if (System.getProperty('os.name').toLowerCase(Locale.ROOT).contains('windows')) {
commandLine "npm.cmd", "audit", "fix"
commandLine 'npm.cmd', 'install' }
else {
commandLine 'npm.cmd', 'install'
} else {
commandLine "npm", "audit", "fix" commandLine 'npm', 'install'
}
}
Expand Down
10 changes: 6 additions & 4 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ logging:
org.hibernate.type.descriptor.sql.BasicBinder: trace

spring:
config:
import: optional:file:.env[.properties]
datasource:
url: jdbc:mysql://www.adapter-gwangalli.com:3306/scjavajjang?characterEncoding=UTF-8&serverTimezone=Asia/Seoul
username: root
password: ivill0080@
driver-class-name: com.mysql.cj.jdbc.Driver
url: ${DB_HOST}/${DB_NAME}
username: ${DB_USERNAME}
password: ${DB_PASSWORD}
driver-class-name: ${DB_CLASSNAME}
jpa:
defer-datasource-initialization: true
hibernate.ddl-auto: update
Expand Down

0 comments on commit f0074cb

Please sign in to comment.