feat: support disable swagger-ui by config #203

This commit is contained in:
tjq 2021-02-06 16:01:56 +08:00
parent 75d922d4a9
commit b24e0d2682
2 changed files with 6 additions and 1 deletions

View File

@ -20,6 +20,10 @@ public class PowerJobServerConfigKey {
* 是否使用 mongoDB
*/
public static final String MONGODB_ENABLE = "oms.mongodb.enable";
/**
* 是否启用 Swagger-UI默认关闭
*/
public static final String SWAGGER_UI_ENABLE = "oms.swagger.enable";
/**
* 钉钉报警相关

View File

@ -1,5 +1,6 @@
package com.github.kfcfans.powerjob.server.common.config;
import com.github.kfcfans.powerjob.server.common.PowerJobServerConfigKey;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
@ -23,7 +24,7 @@ import static springfox.documentation.builders.PathSelectors.any;
*/
@Configuration
@EnableSwagger2
@ConditionalOnProperty(name = "oms.swagger.enable", havingValue = "true")
@ConditionalOnProperty(name = PowerJobServerConfigKey.SWAGGER_UI_ENABLE, havingValue = "true")
public class SwaggerConfig {
private final BuildProperties buildProperties;