Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/#11/applicationyml 파일 수정 환경 변수 설정 #16

Merged

Conversation

drbug2000
Copy link
Collaborator

📝 요약

application.yml 파일 설정 변경
dev와 local로 나누어 설정

이슈 번호 : #11

🔖 변경 사항

application.yml은 dev와 배포용, local은 application-local.yml로 나누었습니다.
application-local.yml은 gitignore적용되어 git에 적용되지 않고, 자유롭게 local 설정에 맞게 수정하시면 됩니다.
application.yml은 수정하시면 안됩니다.

${SPRING_PROFILES_ACTIVE}를 local로 설정해줘야 local에서 application-local.yml 사용 가능합니다

application-local.yml

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

server:
    port: 8080
---
spring:
  config:
    activate:
      on-profile: "localRDB"

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

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

  jpa:
    hibernate:
          ddl-auto: update        # table을 전부 drop했다가 다시 생성 -> 테스트용
    properties:
      hibernate:
        format_sql: true
        show_sql: true
---

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

secret:
  jwt-secret-key: ${JWT_SECRET_KEY:b237a73895f5e617b7364708413fff71c228721a5f8c84a7bb2a3b84f1bb1c23}
  jwt-expired-in: ${JWT_EXPIRED_IN:3600000}
---

✅ 리뷰 요구사항

📸 확인 방법 (선택)



📌 PR 진행 시 이러한 점들을 참고해 주세요

* P1 : 꼭 반영해 주세요 (Request Changes) - 이슈가 발생하거나 취약점이 발견되는 케이스 등
* P2 : 반영을 적극적으로 고려해 주시면 좋을 것 같아요 (Comment)
* P3 : 이런 방법도 있을 것 같아요~ 등의 사소한 의견입니다 (Chore)

@drbug2000 drbug2000 linked an issue Jul 17, 2024 that may be closed by this pull request
3 tasks
@@ -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'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p2: mongoDB 관련 의존성은 제 브랜치에서 추가하겠습니닷

Copy link
Collaborator

@seongjunnoh seongjunnoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다!!

@@ -1,26 +1,89 @@
spring:
profiles:
active: ${SPRING_PROFILES_ACTIVE:dev}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이렇게 나누는거 좋은데여???

datasource:
url: ${DATASOURCE_URL_LOCAL}
username: ${DATASOURCE_USERNAME}
password: ${DATASOURCE_PASSWORD}
driver-class-name: ${DATASOURCE_DRIVER}
driver-class-name: com.mysql.cj.jdbc.Driver
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DATASOURCE_DRIVER 를 환경변수로 안넣은 이유가 뭔가여???

on-profile: "devMongoDB"
data:
mongodb:
uri: mongodb://${MONGO_USERNAME}:${MONGO_PASSWORD}@${MONGO_HOST}:${MONGO_PORT}/${MONGO_DB}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

몽고 db 좋은데여??

Copy link
Collaborator

@arkchive arkchive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good!

@drbug2000 drbug2000 merged commit 102858f into develop Jul 17, 2024
3 checks passed
seongjunnoh pushed a commit that referenced this pull request Oct 30, 2024
…-환경-변수-설정

Chore/#11/applicationyml 파일 수정 환경 변수 설정
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[chore] application.yml 파일 수정 & 환경 변수 설정
4 participants