diff options
author | Ed Tanous <ed@tanous.net> | 2024-04-13 19:11:15 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2024-04-18 18:40:17 +0300 |
commit | 8db83747b6ea72de30ac83f19578ecc37489b13d (patch) | |
tree | 86bd287fc7fa1a93df5761af93554ef45f9bdc18 /src | |
parent | 3e7374243ff53125f3a55c2d0b1927e89261b1f9 (diff) | |
download | bmcweb-8db83747b6ea72de30ac83f19578ecc37489b13d.tar.xz |
Clean up BMCWEB_ENABLE_SSL
This macro came originally from CROW_ENABLE_SSL, and was used as a macro
to optionally compile without openssl being required.
OpenSSL has been pulled into many other dependencies, and has been
functionally required to be included for a long time, so there's no
reason to hold onto this macro.
Remove most uses of the macro, and for the couple functional places the
macro is used, transition to a constexpr if to enable the TLS paths.
This allows a large simplification of code in some places.
Tested: Redfish service validator passes.
Change-Id: Iebd46a68e5e417b6031479e24be3c21bef782f4c
Signed-off-by: Ed Tanous <ed@tanous.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/webserver_run.cpp | 43 |
1 files changed, 5 insertions, 38 deletions
diff --git a/src/webserver_run.cpp b/src/webserver_run.cpp index e5d272ead8..2f28e16818 100644 --- a/src/webserver_run.cpp +++ b/src/webserver_run.cpp @@ -24,43 +24,11 @@ #include "vm_websocket.hpp" #include "webassets.hpp" -#include <systemd/sd-daemon.h> - #include <boost/asio/io_context.hpp> #include <sdbusplus/asio/connection.hpp> #include <sdbusplus/bus.hpp> #include <sdbusplus/server.hpp> -constexpr int defaultPort = 18080; - -static void setupSocket(crow::App& app) -{ - int listenFd = sd_listen_fds(0); - if (1 == listenFd) - { - BMCWEB_LOG_INFO("attempting systemd socket activation"); - if (sd_is_socket_inet(SD_LISTEN_FDS_START, AF_UNSPEC, SOCK_STREAM, 1, - 0) != 0) - { - BMCWEB_LOG_INFO("Starting webserver on socket handle {}", - SD_LISTEN_FDS_START); - app.socket(SD_LISTEN_FDS_START); - } - else - { - BMCWEB_LOG_INFO( - "bad incoming socket, starting webserver on port {}", - defaultPort); - app.port(defaultPort); - } - } - else - { - BMCWEB_LOG_INFO("Starting webserver on port {}", defaultPort); - app.port(defaultPort); - } -} - int run() { auto io = std::make_shared<boost::asio::io_context>(); @@ -122,8 +90,6 @@ int run() crow::login_routes::requestRoutes(app); - setupSocket(app); - #ifdef BMCWEB_ENABLE_VM_NBDPROXY crow::nbd_proxy::requestRoutes(app); #endif @@ -137,10 +103,11 @@ int run() } #endif -#ifdef BMCWEB_ENABLE_SSL - BMCWEB_LOG_INFO("Start Hostname Monitor Service..."); - crow::hostname_monitor::registerHostnameSignal(); -#endif + if constexpr (bmcwebEnableTLS) + { + BMCWEB_LOG_INFO("Start Hostname Monitor Service..."); + crow::hostname_monitor::registerHostnameSignal(); + } bmcweb::registerUserRemovedSignal(); |