summaryrefslogtreecommitdiff
path: root/config/bmcweb_config.h.in
diff options
context:
space:
mode:
authorEd Tanous <ed@tanous.net>2024-04-18 01:40:31 +0300
committerEd Tanous <ed@tanous.net>2024-05-01 18:14:17 +0300
commit25b54dba775b31021a3a4677eb79e9771bcb97f7 (patch)
treefcf84de17508887775cc14a9c15ad4a41d72b049 /config/bmcweb_config.h.in
parentaca174983be5a0d2af08044dd93487908ae6cfe5 (diff)
downloadbmcweb-25b54dba775b31021a3a4677eb79e9771bcb97f7.tar.xz
Bring consistency to config options
The configuration options that exist in bmcweb are an amalgimation of CROW options, CMAKE options using #define, pre-bmcweb ifdef mechanisms and meson options using a config file. This history has led to a lot of different ways to configure code in the codebase itself, which has led to problems, and issues in consistency. ifdef options do no compile time checking of code not within the branch. This is good when you have optional dependencies, but not great when you're trying to ensure both options compile. This commit moves all internal configuration options to: 1. A namespace called bmcweb 2. A naming scheme matching the meson option. hyphens are replaced with underscores, and the option is uppercased. This consistent transform allows matching up option keys with their code counterparts, without naming changes. 3. All options are bool true = enabled, and any options with _ENABLED or _DISABLED postfixes have those postfixes removed. (note, there are still some options with disable in the name, those are left as-is) 4. All options are now constexpr booleans, without an explicit compare. To accomplish this, unfortunately an option list in config/meson.build is required, given that meson doesn't provide a way to dump all options, as is a manual entry in bmcweb_config.h.in, in addition to the meson_options. This obsoletes the map in the main meson.build, which helps some of the complexity. Now that we've done this, we have some rules that will be documented. 1. Runtime behavior changes should be added as a constexpr bool to bmcweb_config.h 2. Options that require optionally pulling in a dependency shall use an ifdef, defined in the primary meson.build. (note, there are no options that currently meet this class, but it's included for completeness.) Note, that this consolidation means that at configure time, all options are printed. This is a good thing and allows direct comparison of configs in log files. Tested: Code compiles Server boots, and shows options configured in the default build. (HTTPS, log level, etc) Change-Id: I94e79a56bcdc01755036e4e7278c7e69e25809ce Signed-off-by: Ed Tanous <ed@tanous.net>
Diffstat (limited to 'config/bmcweb_config.h.in')
-rw-r--r--config/bmcweb_config.h.in72
1 files changed, 50 insertions, 22 deletions
diff --git a/config/bmcweb_config.h.in b/config/bmcweb_config.h.in
index eb0c79c77a..81a61c8b17 100644
--- a/config/bmcweb_config.h.in
+++ b/config/bmcweb_config.h.in
@@ -1,29 +1,57 @@
#pragma once
#include <cstdint>
-#include <cstddef>
#include <string_view>
// clang-format off
-constexpr const bool bmcwebInsecureEnableQueryParams = @BMCWEB_INSECURE_ENABLE_QUERY_PARAMS@ == 1;
-
-constexpr const size_t bmcwebHttpReqBodyLimitMb = @BMCWEB_HTTP_REQ_BODY_LIMIT_MB@;
-
-constexpr const char* mesonInstallPrefix = "@MESON_INSTALL_PREFIX@";
-
-constexpr const bool bmcwebInsecureEnableHttpPushStyleEventing = @BMCWEB_INSECURE_ENABLE_HTTP_PUSH_STYLE_EVENTING@ == 1;
-
-constexpr const char* bmcwebLoggingLevel = "@BMCWEB_LOGGING_LEVEL@";
-
-constexpr const bool bmcwebEnableMultiHost = @BMCWEB_ENABLE_MULTI_HOST@ == 1;
-
-constexpr const bool bmcwebEnableHTTP2 = @BMCWEB_ENABLE_HTTP2@ == 1;
-
-constexpr const bool bmcwebEnableTLS = @BMCWEB_ENABLE_TLS@ == 1;
-
-constexpr const bool bmcwebMTLSCommonNameParsingMeta = @BMCWEB_ENABLE_MTLS_COMMON_NAME_PARSING_META@ == 1;
-
-constexpr const bool bmcwebNbdProxy = @BMCWEB_VIRTUAL_MEDIA_NBD@ == 1;
-
-constexpr const bool bmcwebVmWebsocket = @BMCWEB_VIRTUAL_MEDIA_VM@ == 1;
+// NOLINTBEGIN(readability-identifier-naming)
+
+// String params
+constexpr const std::string_view BMCWEB_LOGGING_LEVEL = "@LOGGING_LEVEL@";
+constexpr const std::string_view BMCWEB_MUTUAL_TLS_COMMON_NAME_PARSING = "@MUTUAL_TLS_COMMON_NAME_PARSING@";
+constexpr const std::string_view BMCWEB_DNS_RESOLVER = "@DNS_RESOLVER@";
+
+// Integer params
+constexpr const uint64_t BMCWEB_HTTP_BODY_LIMIT = @HTTP_BODY_LIMIT@;
+constexpr const uint16_t BMCWEB_HTTPS_PORT = @HTTPS_PORT@;
+
+// Feature Params
+constexpr const bool BMCWEB_BASIC_AUTH = @BASIC_AUTH@;
+constexpr const bool BMCWEB_COOKIE_AUTH = @COOKIE_AUTH@;
+constexpr const bool BMCWEB_EXPERIMENTAL_HTTP2 = @EXPERIMENTAL_HTTP2@;
+constexpr const bool BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM = @EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM@;
+constexpr const bool BMCWEB_HOST_SERIAL_SOCKET = @HOST_SERIAL_SOCKET@;
+constexpr const bool BMCWEB_INSECURE_DISABLE_AUTH = @INSECURE_DISABLE_AUTH@;
+constexpr const bool BMCWEB_INSECURE_DISABLE_CSRF = @INSECURE_DISABLE_CSRF@;
+constexpr const bool BMCWEB_INSECURE_DISABLE_SSL = @INSECURE_DISABLE_SSL@;
+constexpr const bool BMCWEB_INSECURE_ENABLE_REDFISH_QUERY = @INSECURE_ENABLE_REDFISH_QUERY@;
+constexpr const bool BMCWEB_INSECURE_IGNORE_CONTENT_TYPE = @INSECURE_IGNORE_CONTENT_TYPE@;
+constexpr const bool BMCWEB_INSECURE_PUSH_STYLE_NOTIFICATION = @INSECURE_PUSH_STYLE_NOTIFICATION@;
+constexpr const bool BMCWEB_INSECURE_TFTP_UPDATE = @INSECURE_TFTP_UPDATE@;
+constexpr const bool BMCWEB_KVM = @KVM@;
+constexpr const bool BMCWEB_MUTUAL_TLS_AUTH = @MUTUAL_TLS_AUTH@;
+constexpr const bool BMCWEB_REDFISH_AGGREGATION = @REDFISH_AGGREGATION@;
+constexpr const bool BMCWEB_REDFISH_ALLOW_DEPRECATED_POWER_THERMAL = @REDFISH_ALLOW_DEPRECATED_POWER_THERMAL@;
+constexpr const bool BMCWEB_REDFISH_BMC_JOURNAL = @REDFISH_BMC_JOURNAL@;
+constexpr const bool BMCWEB_REDFISH_CPU_LOG = @REDFISH_CPU_LOG@;
+constexpr const bool BMCWEB_REDFISH_DBUS_LOG = @REDFISH_DBUS_LOG@;
+constexpr const bool BMCWEB_REDFISH_DUMP_LOG = @REDFISH_DUMP_LOG@;
+constexpr const bool BMCWEB_REDFISH_HOST_LOGGER = @REDFISH_HOST_LOGGER@;
+constexpr const bool BMCWEB_REDFISH_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM = @REDFISH_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM@;
+constexpr const bool BMCWEB_REDFISH_OEM_MANAGER_FAN_DATA = @REDFISH_OEM_MANAGER_FAN_DATA@;
+constexpr const bool BMCWEB_REDFISH_PROVISIONING_FEATURE = @REDFISH_PROVISIONING_FEATURE@;
+constexpr const bool BMCWEB_REDFISH = @REDFISH@;
+constexpr const bool BMCWEB_REST = @REST@;
+constexpr const bool BMCWEB_SESSION_AUTH = @SESSION_AUTH@;
+constexpr const bool BMCWEB_STATIC_HOSTING = @STATIC_HOSTING@;
+constexpr const bool BMCWEB_TESTS = @TESTS@;
+constexpr const bool BMCWEB_VM_WEBSOCKET = @VM_WEBSOCKET@;
+constexpr const bool BMCWEB_VM_NBDPROXY = false;
+constexpr const bool BMCWEB_XTOKEN_AUTH = @XTOKEN_AUTH@;
+
+// Company specific params
+constexpr const bool BMCWEB_GOOGLE_API = @GOOGLE_API@;
+constexpr const bool BMCWEB_IBM_MANAGEMENT_CONSOLE = @IBM_MANAGEMENT_CONSOLE@;
+
+// NOLINTEND(readability-identifier-naming)
// clang-format on