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

cors allow origin 을 yml에서 읽어오도록 변경 #619

Merged
merged 2 commits into from
Sep 9, 2024

Conversation

jminkkk
Copy link
Contributor

@jminkkk jminkkk commented Sep 9, 2024

⚡️ 관련 이슈

close #615

📍주요 변경 사항

  1. @ConfigurationProperties 로 값 yml 에서 읽어오도록 변경

🎸기타

  1. dev, prod yml 파일 수정

@jminkkk jminkkk added refactor 요구사항이 바뀌지 않은 변경사항 BE 백엔드 labels Sep 9, 2024
@jminkkk jminkkk added this to the 1.1.1 배포 milestone Sep 9, 2024
@jminkkk jminkkk self-assigned this Sep 9, 2024
Comment on lines +13 to +14
@DefaultValue(value = "") String[] allowedOrigins,
@DefaultValue(value = "") String[] allowedOriginsPatterns
Copy link
Contributor Author

Choose a reason for hiding this comment

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

yml 에 값이 없을 경우, NPE 예방을 위해 기본값 설정해놨습니다~

Copy link
Contributor

@HoeSeong123 HoeSeong123 left a comment

Choose a reason for hiding this comment

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

혹시 프론트와 localhost 통신을 통한 테스트가 진행되었나요?
정상 동작하는지만 확인됐다면 바로 approve 하겠습니다!
고생하셨습니다 몰리

@jminkkk
Copy link
Contributor Author

jminkkk commented Sep 9, 2024

혹시 프론트와 localhost 통신을 통한 테스트가 진행되었나요? 정상 동작하는지만 확인됐다면 바로 approve 하겠습니다! 고생하셨습니다 몰리

로직 자체는 변경이 없고 값을 잘 가져오는지 체크만 하면 된다고 생각해요
프론트와의 통신은 하지 않았고 로컬에서 실행 시켜서 yml 파일의 값을 가져오는지는 확인 했습니다~

Copy link
Contributor

@zeus6768 zeus6768 left a comment

Choose a reason for hiding this comment

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

다음의 테스트 추가와 파일 수정을 하면 좋겠어요~

@SpringBootTest
public class PropertiesScanTest {

    @Autowired
    private CorsProperties corsProperties;

    @Test
    void scanConfigurationProperties() {
        assertThat(corsProperties.getAllowedOrigins()).isEqualTo(new String[]{"http://localhost:3000"});
        assertThat(corsProperties.getAllowedOriginsPatterns()).isEqualTo(new String[]{""});
    }
}
# `test/resource/application-local.yml`
spring:
  output:
    ansi:
      enabled: always
cors:
  allowed-origins: http://localhost:3000

Copy link
Contributor

@kyum-q kyum-q left a comment

Choose a reason for hiding this comment

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

GOOD 몰리 ~

Copy link
Contributor

@HoeSeong123 HoeSeong123 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다 몰리👍👍👍

Copy link
Contributor

@zeus6768 zeus6768 left a comment

Choose a reason for hiding this comment

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

👍

@zangsu zangsu merged commit 306c3b9 into dev/be Sep 9, 2024
5 checks passed
@zangsu zangsu deleted the refactor/615-cors-properties-scan branch September 9, 2024 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE 백엔드 refactor 요구사항이 바뀌지 않은 변경사항
Projects
Status: Weekend Done
Development

Successfully merging this pull request may close these issues.

5 participants