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

支持通过配置关闭Swagger #1231

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
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
Loading