Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ out/
### VS Code ###
.vscode/

application-*.yml
src/main/resources/application-private.yml

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

security-medium medium

.gitignore에서 application-*.yml 와일드카드 패턴을 제거하고 특정 파일만 지정할 경우, 보안 정보가 포함된 다른 프로필 설정 파일이 실수로 Git에 추적될 위험이 있습니다. 보안을 위해 기존의 와일드카드 패턴을 유지하는 것을 권장합니다.

application-*.yml

22 changes: 22 additions & 0 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
server:
port: 8080

spring:
datasource:
url: ${PROD_DB_URL}
username: ${PROD_DB_USERNAME}
password: ${PROD_DB_PASSWORD}
driver-class-name: com.mysql.cj.jdbc.Driver

jpa:
hibernate:
ddl-auto: update
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL8Dialect
Comment on lines +13 to +16

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

운영 환경(prod)에서 ddl-auto: update 설정은 의도치 않은 스키마 변경으로 인한 데이터 유실 위험이 있어 validate 사용을 권장합니다. 또한, Hibernate 5.x 이상에서는 Dialect를 자동으로 감지하므로 불필요한 명시적 설정을 제거하여 유지보수성을 높이는 것이 좋습니다.

      ddl-auto: validate


cors:
allowed-origins: https://crew-wiki.site, https://api.crew-wiki.site

swagger:
server-url: https://api.crew-wiki.site
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
spring:
profiles:
include: private
active: local # prod (배포 환경)
active: local # 기본 로컬 실행 프로필
Original file line number Diff line number Diff line change
Expand Up @@ -89,40 +89,6 @@ void getDocumentLatestVersion_success_byExistsDocument() {
}
}

@Nested
@DisplayName("문서 uuid로 삭제 기능")
class deleteByUuid {

@DisplayName("존재하는 문서 id일 경우 문서가 로그들과 함께 삭제된다")
@Test
void deleteById_success_byExistsId() {
// given
DocumentResponse documentResponse = crewDocumentService.create(
CrewDocumentFixture.createDocumentCreateRequest("title1", "content1", "writer1", 10L,
UUID.randomUUID()));

// before then
assertThat(documentRepository.findAll()).hasSize(1);
assertThat(historyRepository.findAll()).hasSize(1);

// when
crewDocumentService.deleteByUuid(documentResponse.documentUUID());

// after then
assertThat(documentRepository.findAll()).hasSize(0);
assertThat(historyRepository.findAll()).hasSize(0);
}

@DisplayName("존재하지 않는 문서의 id일 경우 예외가 발생한다 : WikiException.DOCUMENT_NOT_FOUND")
@Test
void deleteById_throwsException_byNonExistsId() {
// when & then
WikiException ex = assertThrows(WikiException.class,
() -> crewDocumentService.deleteByUuid(UUID.randomUUID()));
assertThat(ex.getErrorCode()).isEqualTo(DOCUMENT_NOT_FOUND);
}
}

@Nested
@DisplayName("문서 uuid로 삭제 기능")
class DeleteByUuid {
Expand Down
Loading