mirror of
https://github.com/Qortal/qortal.git
synced 2025-03-26 23:44:34 +00:00
Add settings toggle "apiDocumentationEnabled" which is false by default.
API documentation support seems to take a lot of extra memory, so this is disabled by default for router-based nodes.
This commit is contained in:
parent
06794ab36c
commit
238487ea98
@ -99,16 +99,18 @@ public class ApiService {
|
|||||||
apiServlet.setInitOrder(1);
|
apiServlet.setInitOrder(1);
|
||||||
context.addServlet(apiServlet, "/*");
|
context.addServlet(apiServlet, "/*");
|
||||||
|
|
||||||
// Swagger-UI static content
|
if (Settings.getInstance().isApiDocumentationEnabled()) {
|
||||||
ClassLoader loader = this.getClass().getClassLoader();
|
// Swagger-UI static content
|
||||||
ServletHolder swaggerUIServlet = new ServletHolder("static-swagger-ui", DefaultServlet.class);
|
ClassLoader loader = this.getClass().getClassLoader();
|
||||||
swaggerUIServlet.setInitParameter("resourceBase", loader.getResource("resources/swagger-ui/").toString());
|
ServletHolder swaggerUIServlet = new ServletHolder("static-swagger-ui", DefaultServlet.class);
|
||||||
swaggerUIServlet.setInitParameter("dirAllowed", "true");
|
swaggerUIServlet.setInitParameter("resourceBase", loader.getResource("resources/swagger-ui/").toString());
|
||||||
swaggerUIServlet.setInitParameter("pathInfoOnly", "true");
|
swaggerUIServlet.setInitParameter("dirAllowed", "true");
|
||||||
context.addServlet(swaggerUIServlet, "/api-documentation/*");
|
swaggerUIServlet.setInitParameter("pathInfoOnly", "true");
|
||||||
|
context.addServlet(swaggerUIServlet, "/api-documentation/*");
|
||||||
|
|
||||||
rewriteHandler.addRule(new RedirectPatternRule("", "/api-documentation/")); // redirect to Swagger UI start page
|
rewriteHandler.addRule(new RedirectPatternRule("", "/api-documentation/")); // redirect to Swagger UI start page
|
||||||
rewriteHandler.addRule(new RedirectPatternRule("/api-documentation", "/api-documentation/")); // redirect to Swagger UI start page
|
rewriteHandler.addRule(new RedirectPatternRule("/api-documentation", "/api-documentation/")); // redirect to Swagger UI start page
|
||||||
|
}
|
||||||
|
|
||||||
// Start server
|
// Start server
|
||||||
this.server.start();
|
this.server.start();
|
||||||
|
@ -61,6 +61,7 @@ public class Settings {
|
|||||||
};
|
};
|
||||||
private Boolean apiRestricted;
|
private Boolean apiRestricted;
|
||||||
private boolean apiLoggingEnabled = false;
|
private boolean apiLoggingEnabled = false;
|
||||||
|
private boolean apiDocumentationEnabled = false;
|
||||||
|
|
||||||
// Specific to this node
|
// Specific to this node
|
||||||
private boolean wipeUnconfirmedOnStart = false;
|
private boolean wipeUnconfirmedOnStart = false;
|
||||||
@ -286,6 +287,10 @@ public class Settings {
|
|||||||
return this.apiLoggingEnabled;
|
return this.apiLoggingEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isApiDocumentationEnabled() {
|
||||||
|
return this.apiDocumentationEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getWipeUnconfirmedOnStart() {
|
public boolean getWipeUnconfirmedOnStart() {
|
||||||
return this.wipeUnconfirmedOnStart;
|
return this.wipeUnconfirmedOnStart;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user