1) .properties OR .yml 파일 복사

메인 레포지토리(blog-team-three-CoderHive-BE) 옆에 새로운 폴더 생성

새로운 폴더 생성 -> application-secret

 

application.properties OR application.yml 복사 후 application-secret 폴더에 붙여넣기

메인 프로젝트의 application.yml 복사
application-secret 폴더에 .yml 파일 붙여넣기 -> 파일명 변경

파일명은 application.yml  --> secret.yml 로 변경

 

이후 github 원격 저장소에 새로운 레포지토리를 private로 생성하고 application-secret과 연동한다.

 

 

2) 메인 프로젝트의 서브 모듈로 추가

 

메인 프로젝트의 src/main/resources 로 이동

 

위에서 생성한 secret 레포지토리를 서브모듈로 추가한다

$ git submodule add <서브모듈주소> <폴더이름>

 

아래처럼 폴더가 추가된다.

 

 

이 후 메인 프로젝트의 application 파일에 해당 코드 입력

application.properties

spring.config.import=secret/secret.properties

 

application.yml

spring:
  config:
    import: secret/secret.yml

 

폴더 구성

폴더 구성