Search
Duplicate

[스프링 게시판] Git 및 Github 등록

@3/7/2023

설정 파일 분리

막상 깃허브에 올릴 것을 생각하니 application.yml에 있는 비밀번호를 어떻게 할 지가 고민이 됨
application.yaml
spring: profiles: include: mysql jpa: hibernate: ddl-auto: create properties: hibernate: dialect: org.hibernate.dialect.MySQLDialect format_sql: true
YAML
복사
spring-include 속성을 통해 아래 설정파일 추가
application-mysql.yaml
spring: datasource: url: jdbc:mysql://localhost:3306/springforumdb username: springforumuser password: 1234 driver-class-name: com.mysql.cj.jdbc.Driver
YAML
복사
두 파일로 나누고 application-mysql.yaml은 .gitignore에 등록함
### Security ### application-mysql.yaml
YAML
복사

깃 초기화 및 Github 저장소 푸시

$ git init $ git add . $ git commit -am "first commit" $ git remote add origin https://github.com/gyuray-dev/spring_forum.git $ git push -u origin main
Shell
복사
성공적으로 올라감

SourceTree 등록