Skip to content

Commit

Permalink
fix: Swagger 에서 요청을 보내는 URL 을 각 환경에 맞게 지정 (issue #333) (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
robinjoon authored Aug 20, 2024
1 parent 4a5bd17 commit 349825f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion backend/src/main/java/develup/api/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
package develup.api.config;

import java.util.List;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.servers.Server;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SwaggerConfig {
@Value("${api-host}")
private String hostAddress;

@Bean
public OpenAPI openAPI() {
Server server = new Server();
server.setUrl(hostAddress);
return new OpenAPI()
.components(new Components())
.info(info());
.info(info())
.servers(List.of(server));
}

private Info info() {
Expand Down

0 comments on commit 349825f

Please sign in to comment.