diff --git a/src/main/java/com/damyo/alpha/global/config/SwaggerConfig.java b/src/main/java/com/damyo/alpha/global/config/SwaggerConfig.java index 698b708..de51cb3 100644 --- a/src/main/java/com/damyo/alpha/global/config/SwaggerConfig.java +++ b/src/main/java/com/damyo/alpha/global/config/SwaggerConfig.java @@ -6,12 +6,18 @@ import io.swagger.v3.oas.models.security.SecurityRequirement; import io.swagger.v3.oas.models.security.SecurityScheme; 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; +import java.util.List; + @Configuration public class SwaggerConfig { + @Value("${springdoc.swagger-ui.swg3-address}") + private String address; + @Bean public OpenAPI openAPI() { String jwt = "jwt"; @@ -24,10 +30,13 @@ public OpenAPI openAPI() { .scheme("bearer") .bearerFormat("token")); + Server server = new Server(); + server.setUrl(address); + return new OpenAPI() - .addServersItem(new Server().url("/")) .info(apiInfo()) - .components(components); + .components(components) + .servers(List.of(server)); } private Info apiInfo() { diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index b9ca000..a17825c 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -63,5 +63,6 @@ springdoc: tags-sorter: alpha operations-sorter: alpha persist-authorization: true + swg3-address: ${SWG3_ADDRESS} paths-to-match: - /api/** \ No newline at end of file