Skip to content

Commit

Permalink
Merge pull request #16 from KUIT-Space/chore/#11/applicationyml-파일-수정…
Browse files Browse the repository at this point in the history
…-환경-변수-설정

Chore/#11/applicationyml 파일 수정 환경 변수 설정
  • Loading branch information
drbug2000 authored Jul 17, 2024
2 parents 47fc76e + 424b118 commit 102858f
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 12 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,22 @@ jobs:
with:
distribution: 'temurin'
java-version: '17'
# (5) Gradle build (Test 제외)
# (4.5) application.yml file 설정
- name: Set yml file
uses: microsoft/variable-substitution@v1
with:
files: ${{ env.RESOURCE_PATH }}
env:
spring.datasource.url: ${{ secrets.RDS_HOST }}
spring.datasource.username: ${{ secrets.RDS_USERNAME }}
spring.datasource.password: ${{ secrets.RDS_PASSWORD }}
secret.jwt-secret-key: ${{secrets.JWT_SECRET_KEY}}
secret.jwt-login-secret-key: ${{secrets.JWT_SECRET_KEY_1}}
secret.jwt-user-secret-key: ${{secrets.JWT_SECRET_KEY_2}}
secret.jwt-expired-in: ${{secrets.JWT_EXPIRED_IN}}
spring.datasource.driver-class-name: com.mysql.cj.jdbc.Driver

# (5) Gradle build (Test 제외)
- name: Build with Gradle
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
with:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ out/

### VS Code ###
.vscode/

### application-local.yml ###
src/main/resource/application-local.yml
/**/application-local.yml
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
// runtimeOnly 'com.mysql:mysql-connector-j'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
Expand Down
86 changes: 76 additions & 10 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,93 @@
spring:
profiles:
active: ${SPRING_PROFILES_ACTIVE:dev}
group:
"local": "localRDB, localMongoDB, localJPA, localPort, localSecret, web-mvc"
"dev": "devRDB, devMongoDB, devPort, devJPA, devSecret, web-mvc"
"prod": "devRDB, devMongoDB, devPort, prodJPA, devSecret, web-mvc"
---
spring:
config:
activate:
on-profile: "devPort"

server:
port: 8080

---
spring:
config:
activate:
on-profile: "devRDB"

datasource:
url: ${DATASOURCE_URL_LOCAL}
url: ${DATASOURCE_URL}
username: ${DATASOURCE_USERNAME}
password: ${DATASOURCE_PASSWORD}
driver-class-name: ${DATASOURCE_DRIVER}
driver-class-name: jdbc:mysql://com.mysql.cj.jdbc.Driver
logging:
level:
org.hibernate.sql: debug
---
spring:
config:
activate:
on-profile: "devMongoDB"
data:
mongodb:
uri: mongodb://${MONGO_USERNAME}:${MONGO_PASSWORD}@${MONGO_HOST}:${MONGO_PORT}/${MONGO_DB}

---
spring:
config:
activate:
on-profile: "devJPA"

jpa:
hibernate:
ddl-auto: create # create : 존재하는 table을 전부 drop했다가 다시 생성 -> 테스트용
ddl-auto: validate

properties:
hibernate:
format_sql: true
show_sql: true
---
spring:
config:
activate:
on-profile: "prodJPA"

jpa:
hibernate:
ddl-auto: none
properties:
hibernate:
show_sql: false
---
spring:
config:
activate:
on-profile: "devSecret"

secret:
jwt-login-secret-key: ${JWT_LOGIN_SECRET_KEY}
jwt-user-space-secret-key: ${JWT_USER_SPACE_SECRET_KEY}
jwt-expired-in: ${JWT_EXPIRED_IN}
jwt-secret-key: ${JWT_SECRET_KEY}
jwt-login-secret-key: ${JWT_SECRET_KEY_LOGIN}
jwt-user-secret-key: ${JWT_SECRET_KEY_USER}
jwt-expired-in: ${JWT_EXPIRED_IN:3600000}
---

spring:
config:
activate:
on-profile: "web-mvc"

mvc:
throw-exception-if-no-handler-found: true

web:
resources:
add-mappings: false

messages:
basename: errors


logging:
level:
org.hibernate.sql: debug

0 comments on commit 102858f

Please sign in to comment.