Skip to content

Commit

Permalink
支持通过配置关闭Swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
ZQKC committed Jun 30, 2024
1 parent 232f06e commit c1e858e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions km-console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
<configuration>
<nodeVersion>v12.22.12</nodeVersion>
<npmVersion>6.14.16</npmVersion>
<nodeDownloadRoot>https://npm.taobao.org/mirrors/node/</nodeDownloadRoot>
<npmDownloadRoot>https://registry.npm.taobao.org/npm/-/</npmDownloadRoot>
<nodeDownloadRoot>https://npmmirror.com/mirrors/node/</nodeDownloadRoot>
<npmDownloadRoot>https://registry.npmmirror.com/npm/-/</npmDownloadRoot>
</configuration>
</execution>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.xiaojukeji.know.streaming.km.common.utils.GitPropUtil;
import com.xiaojukeji.know.streaming.km.rest.interceptor.PermissionInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;
Expand All @@ -24,6 +25,9 @@ public class WebConfig implements WebMvcConfigurer {

private static final String FE_INDEX_PAGE_HTML = "layout/index";

@Value(value = "${swagger.enabled:true}")
private Boolean swaggerEnabled;

@Override
public void addViewControllers(ViewControllerRegistry registry) {
// FE-首页
Expand Down Expand Up @@ -69,7 +73,7 @@ public Docket createRestApi() {
RequestHandlerSelectors.basePackage("com.didiglobal.logi.security.controller")))
.paths(PathSelectors.any())
.build()
.enable(true);
.enable(swaggerEnabled != null && swaggerEnabled);
}

private ApiInfo apiInfo() {
Expand Down
5 changes: 4 additions & 1 deletion km-rest/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,7 @@ management:
descriptions: true
enabled: true
tags:
application: know-streaming
application: know-streaming

swagger:
enabled: true

0 comments on commit c1e858e

Please sign in to comment.