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
10 changes: 7 additions & 3 deletions src/main/java/com/example/withpeace/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.servers.Server;
import io.swagger.v3.oas.models.tags.Tag;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import io.swagger.v3.oas.models.Components;
Expand All @@ -14,8 +15,13 @@

@Configuration
public class SwaggerConfig {

@Value("${swagger.server-url}")
private String serverUrl;

@Bean
public OpenAPI openAPI() {
Server server = new Server().url(serverUrl); // 환경별 URL 반영

// 소셜 로그인용 SecurityScheme
SecurityScheme socialAuthScheme = new SecurityScheme()
Expand All @@ -37,15 +43,13 @@ public OpenAPI openAPI() {
SecurityRequirement defaultRequirement = new SecurityRequirement()
.addList("Access Token");

Server prodServer = new Server().url("https://cheongha.site"); // 운영 서버 URL

return new OpenAPI()
.info(apiInfo())
.components(new Components()
.addSecuritySchemes("Social Auth", socialAuthScheme)
.addSecuritySchemes("Access Token", accessTokenScheme))
.addSecurityItem(defaultRequirement) // 전역 설정으로 Access Token 사용
.addServersItem(prodServer) // 운영 서버 URL
.addServersItem(server)

.tags(Arrays.asList(
new Tag().name("Auth").description("인증 및 회원 관리 API"),
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ springdoc:
swagger-ui:
operations-sorter: method # HTTP 메소드 순으로 정렬 (DELETE, GET, PATCH, POST, PUT)

swagger:
server-url: http://localhost:8080

jwt.secret: ${JWT_SECRET}
slack.webhook.url: ${SLACK_WEBHOOK_URL}

Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ springdoc:
swagger-ui:
operations-sorter: method # HTTP 메소드 순으로 정렬 (DELETE, GET, PATCH, POST, PUT)

swagger:
server-url: https://cheongha.xyz # 운영 서버 URL 설정

jwt.secret: ${JWT_SECRET}
slack.webhook.url: ${SLACK_WEBHOOK_URL}

Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ springdoc:
swagger-ui:
operations-sorter: method # HTTP 메소드 순으로 정렬 (DELETE, GET, PATCH, POST, PUT)

swagger:
server-url: https://staging.cheongha.xyz # 스테이징 서버 URL 설정

jwt.secret: ${JWT_SECRET}
slack.webhook.url: ${SLACK_WEBHOOK_URL}

Expand Down