Browse Source

added ability to disable swagger

pull/8575/head
YevhenBondarenko 3 years ago
parent
commit
ef735934f2
  1. 3
      application/src/main/java/org/thingsboard/server/config/SwaggerConfiguration.java
  2. 1
      application/src/main/resources/thingsboard.yml

3
application/src/main/java/org/thingsboard/server/config/SwaggerConfiguration.java

@ -87,6 +87,8 @@ import static springfox.documentation.builders.PathSelectors.regex;
@Profile("!test")
public class SwaggerConfiguration {
@Value("${swagger.enabled:true}")
private boolean enabled;
@Value("${swagger.api_path_regex}")
private String apiPathRegex;
@Value("${swagger.security_path_regex}")
@ -116,6 +118,7 @@ public class SwaggerConfiguration {
public Docket thingsboardApi() {
TypeResolver typeResolver = new TypeResolver();
return new Docket(DocumentationType.OAS_30)
.enable(enabled)
.groupName("thingsboard")
.apiInfo(apiInfo())
.additionalModels(

1
application/src/main/resources/thingsboard.yml

@ -989,6 +989,7 @@ edges:
persistToTelemetry: "${EDGES_PERSIST_STATE_TO_TELEMETRY:false}"
swagger:
enabled: "${SWAGGER_ENABLED:true}"
api_path_regex: "${SWAGGER_API_PATH_REGEX:/api/.*}"
security_path_regex: "${SWAGGER_SECURITY_PATH_REGEX:/api/.*}"
non_security_path_regex: "${SWAGGER_NON_SECURITY_PATH_REGEX:/api/(?:noauth|v1)/.*}"

Loading…
Cancel
Save