Skip to content

Commit

Permalink
refactor: simplify the code
Browse files Browse the repository at this point in the history
  • Loading branch information
yuezk committed Jun 21, 2023
1 parent f746df5 commit fb39d92
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,16 @@ private void updateServerConf(Path confPath, TomcatRunConfiguration cfg)

portShutdown.setAttribute("port", String.valueOf(cfg.getAdminPort()));
portE.setAttribute("port", String.valueOf(cfg.getPort()));
if (sslPortE != null && cfg.getSslPort() != null && StringUtil.isNotEmpty(String.valueOf(cfg.getSslPort()))) {
portE.setAttribute("redirectPort", String.valueOf(cfg.getSslPort()));
sslPortE.setAttribute("port", String.valueOf(cfg.getSslPort()));
} else if (portE.hasAttribute("redirectPort")) {
Integer sslPort = cfg.getSslPort();

if (sslPortE != null && sslPort != null) {
// Update SSL configuration
sslPortE.setAttribute("port", sslPort.toString());
portE.setAttribute("redirectPort", sslPort.toString());
} else {
// Clean up SSL configuration
portE.removeAttribute("redirectPort");
if (sslPortE != null && serviceE != null) {
if (serviceE != null && sslPortE != null) {
serviceE.removeChild(sslPortE);
}
}
Expand Down

0 comments on commit fb39d92

Please sign in to comment.