Nan Zhou | 307386e | 2022-10-12 20:29:34 +0000 | [diff] [blame] | 1 | # Gather the Configuration data |
| 2 | |
| 3 | conf_data = configuration_data() |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 4 | |
| 5 | feature_options = [ |
| 6 | 'basic-auth', |
| 7 | 'cookie-auth', |
Alexander Hansen | 6c58a03 | 2024-11-21 15:27:04 -0800 | [diff] [blame] | 8 | 'experimental-redfish-dbus-log-subscription', |
Ed Tanous | f4225d7 | 2025-02-20 14:56:15 -0800 | [diff] [blame] | 9 | 'experimental-redfish-multi-computer-system', |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 10 | 'google-api', |
| 11 | 'host-serial-socket', |
Ed Tanous | b253906 | 2024-03-12 16:58:35 -0700 | [diff] [blame] | 12 | 'http-zstd', |
Ed Tanous | 39fe3af | 2025-02-17 11:34:12 -0800 | [diff] [blame] | 13 | 'http2', |
Gunnar Mills | 6889620 | 2024-08-21 11:34:20 -0500 | [diff] [blame] | 14 | 'hypervisor-computer-system', |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 15 | 'ibm-management-console', |
| 16 | 'insecure-disable-auth', |
| 17 | 'insecure-disable-csrf', |
| 18 | 'insecure-disable-ssl', |
| 19 | 'insecure-enable-redfish-query', |
| 20 | 'insecure-ignore-content-type', |
| 21 | 'insecure-push-style-notification', |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 22 | 'kvm', |
| 23 | 'mutual-tls-auth', |
Ed Tanous | f4225d7 | 2025-02-20 14:56:15 -0800 | [diff] [blame] | 24 | 'redfish', |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 25 | 'redfish-aggregation', |
Janet Adkins | f664fd8 | 2025-07-23 14:01:43 -0500 | [diff] [blame] | 26 | 'redfish-allow-deprecated-indicatorled', |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 27 | 'redfish-allow-deprecated-power-thermal', |
Ed Tanous | 6a37140 | 2024-12-03 14:01:25 -0800 | [diff] [blame] | 28 | 'redfish-allow-simple-update', |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 29 | 'redfish-bmc-journal', |
| 30 | 'redfish-cpu-log', |
| 31 | 'redfish-dbus-log', |
| 32 | 'redfish-dump-log', |
| 33 | 'redfish-host-logger', |
| 34 | 'redfish-new-powersubsystem-thermalsubsystem', |
| 35 | 'redfish-oem-manager-fan-data', |
| 36 | 'redfish-provisioning-feature', |
Jagpal Singh Gill | 5785566 | 2024-04-17 10:44:27 -0700 | [diff] [blame] | 37 | 'redfish-updateservice-use-dbus', |
Ed Tanous | f4225d7 | 2025-02-20 14:56:15 -0800 | [diff] [blame] | 38 | 'redfish-use-3-digit-messageid', |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 39 | 'rest', |
| 40 | 'session-auth', |
| 41 | 'static-hosting', |
| 42 | 'tests', |
| 43 | 'vm-websocket', |
| 44 | 'xtoken-auth', |
| 45 | ] |
| 46 | |
| 47 | string_options = [ |
| 48 | 'dns-resolver', |
Ed Tanous | 3ce3688 | 2024-06-09 10:58:16 -0700 | [diff] [blame] | 49 | 'mutual-tls-common-name-parsing-default', |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 50 | 'redfish-manager-uri-name', |
| 51 | 'redfish-system-uri-name', |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 52 | ] |
| 53 | |
rohitpai | cf9085a | 2025-02-24 12:33:59 +0530 | [diff] [blame] | 54 | int_options = ['http-body-limit', 'watchdog-timeout-seconds'] |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 55 | |
Ed Tanous | 7e5e98d | 2025-03-12 10:34:24 -0700 | [diff] [blame] | 56 | feature_options_string = '\n// Feature options\n' |
Ed Tanous | fe907df | 2024-05-07 16:37:09 -0700 | [diff] [blame] | 57 | string_options_string = '\n// String options\n' |
| 58 | int_options_string = '\n// Integer options\n' |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 59 | |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 60 | |
Ed Tanous | 7e5e98d | 2025-03-12 10:34:24 -0700 | [diff] [blame] | 61 | foreach feature_type, feature_list : { |
| 62 | 'Feature': feature_options, |
| 63 | 'Numeric': int_options, |
| 64 | 'String': string_options, |
| 65 | } |
| 66 | summary_dict = {} |
| 67 | foreach option_key : feature_list |
| 68 | option_key_config = 'BMCWEB_' + option_key.to_upper() |
| 69 | option_key_config = option_key_config.replace('-', '_') |
Ed Tanous | fe907df | 2024-05-07 16:37:09 -0700 | [diff] [blame] | 70 | |
Ed Tanous | 7e5e98d | 2025-03-12 10:34:24 -0700 | [diff] [blame] | 71 | opt = get_option(option_key) |
| 72 | if feature_type == 'Feature' |
| 73 | opt = opt.allowed() |
| 74 | feature_options_string += 'constexpr const bool @0@=@1@;\n'.format( |
| 75 | option_key_config, |
| 76 | opt.to_string(), |
| 77 | ) |
| 78 | endif |
| 79 | if feature_type == 'Numeric' |
| 80 | int_options_string += 'constexpr const int @0@=@1@;\n'.format( |
| 81 | option_key_config, |
| 82 | opt.to_string(), |
| 83 | ) |
| 84 | endif |
| 85 | if feature_type == 'String' |
| 86 | string_options_string += 'constexpr std::string_view @0@="@1@";\n'.format( |
| 87 | option_key_config, |
| 88 | opt, |
| 89 | ) |
| 90 | endif |
| 91 | summary_dict += {option_key: opt} |
| 92 | endforeach |
| 93 | summary(summary_dict, section: feature_type + ' Options', bool_yn: true) |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 94 | endforeach |
| 95 | |
Myung Bae | 662aa6e | 2023-01-10 14:20:28 -0600 | [diff] [blame] | 96 | # Logging level |
| 97 | loglvlopt = get_option('bmcweb-logging') |
| 98 | if get_option('buildtype').startswith('debug') and loglvlopt == 'disabled' |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 99 | # Override logging level as 'debug' if 'bmcweb-logging' is set as 'disabled' |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 100 | loglvlopt = 'debug' |
Myung Bae | 662aa6e | 2023-01-10 14:20:28 -0600 | [diff] [blame] | 101 | endif |
Ed Tanous | e7245fe | 2023-07-24 17:01:38 -0700 | [diff] [blame] | 102 | loglvlopt = loglvlopt.to_upper() |
Ed Tanous | fe907df | 2024-05-07 16:37:09 -0700 | [diff] [blame] | 103 | string_options_string += 'constexpr std::string_view BMCWEB_LOGGING_LEVEL' + ' = "' + loglvlopt + '";\n' |
| 104 | |
| 105 | # NBD proxy is disabled due to lack of maintenance. See meson_options.txt |
Ed Tanous | 7e5e98d | 2025-03-12 10:34:24 -0700 | [diff] [blame] | 106 | feature_options_string += 'constexpr const bool BMCWEB_VM_NBDPROXY = false;\n' |
Ed Tanous | fe907df | 2024-05-07 16:37:09 -0700 | [diff] [blame] | 107 | |
| 108 | conf_data.set( |
| 109 | 'BMCWEB_OPTIONS', |
| 110 | string_options_string + int_options_string + feature_options_string, |
| 111 | ) |
Myung Bae | 662aa6e | 2023-01-10 14:20:28 -0600 | [diff] [blame] | 112 | |
Nan Zhou | 307386e | 2022-10-12 20:29:34 +0000 | [diff] [blame] | 113 | conf_h_dep = declare_dependency( |
| 114 | include_directories: include_directories('.'), |
| 115 | sources: configure_file( |
| 116 | input: 'bmcweb_config.h.in', |
| 117 | output: 'bmcweb_config.h', |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 118 | configuration: conf_data, |
| 119 | ), |
Nan Zhou | 307386e | 2022-10-12 20:29:34 +0000 | [diff] [blame] | 120 | ) |
| 121 | |
| 122 | # Configure and install systemd unit files |
Ed Tanous | 796ba93 | 2020-08-02 04:29:21 +0000 | [diff] [blame] | 123 | https_port = get_option('https_port') |
| 124 | if https_port > 0 |
| 125 | configure_file( |
| 126 | input: 'bmcweb.socket.in', |
| 127 | output: 'bmcweb.socket', |
| 128 | install_dir: systemd_system_unit_dir, |
| 129 | install: true, |
| 130 | configuration: configuration_data( |
| 131 | { |
| 132 | 'BMCWEB_PORT': https_port, |
| 133 | 'HTTP_LEVEL_ALLOWED': 'https', |
| 134 | 'HTTP_AUTH_LEVEL': 'auth', |
| 135 | 'HTTP_BIND': '', |
| 136 | }, |
| 137 | ), |
| 138 | ) |
| 139 | endif |
| 140 | |
| 141 | ports = get_option('additional-ports') |
| 142 | binds = get_option('additional-bind-to-device') |
Janet Adkins | 58d3aab | 2025-02-19 14:45:43 -0600 | [diff] [blame] | 143 | auths = get_option('additional-auth') |
Ed Tanous | 796ba93 | 2020-08-02 04:29:21 +0000 | [diff] [blame] | 144 | foreach index : range(ports.length()) |
| 145 | port_number = ports[index] |
| 146 | bind_to_device = '0.0.0.0' |
| 147 | auth = 'auth' |
| 148 | if index < binds.length() |
Janet Adkins | 58d3aab | 2025-02-19 14:45:43 -0600 | [diff] [blame] | 149 | bind_to_device = binds[index] |
Ed Tanous | 796ba93 | 2020-08-02 04:29:21 +0000 | [diff] [blame] | 150 | endif |
| 151 | |
Janet Adkins | 58d3aab | 2025-02-19 14:45:43 -0600 | [diff] [blame] | 152 | if index < auths.length() |
| 153 | auth = auths[index] |
Ed Tanous | 796ba93 | 2020-08-02 04:29:21 +0000 | [diff] [blame] | 154 | endif |
| 155 | |
Janet Adkins | 58d3aab | 2025-02-19 14:45:43 -0600 | [diff] [blame] | 156 | filename = 'bmcweb_' + port_number |
Ed Tanous | 796ba93 | 2020-08-02 04:29:21 +0000 | [diff] [blame] | 157 | configure_file( |
| 158 | input: 'bmcweb.socket.in', |
| 159 | output: filename, |
| 160 | install_dir: systemd_system_unit_dir, |
| 161 | install: true, |
| 162 | configuration: configuration_data( |
| 163 | { |
| 164 | 'BMCWEB_HTTPS_PORT': port_number, |
| 165 | 'HTTP_LEVEL_ALLOWED': 'https', |
Janet Adkins | 58d3aab | 2025-02-19 14:45:43 -0600 | [diff] [blame] | 166 | 'HTTP_BIND': bind_to_device, |
Ed Tanous | 796ba93 | 2020-08-02 04:29:21 +0000 | [diff] [blame] | 167 | 'HTTP_AUTH_LEVEL': auth, |
| 168 | }, |
| 169 | ), |
| 170 | ) |
| 171 | endforeach |
Nan Zhou | 307386e | 2022-10-12 20:29:34 +0000 | [diff] [blame] | 172 | |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 173 | configure_file( |
| 174 | input: 'bmcweb.service.in', |
| 175 | output: 'bmcweb.service', |
| 176 | install_dir: systemd_system_unit_dir, |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 177 | install: true, |
Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 178 | configuration: configuration_data( |
rohitpai | cf9085a | 2025-02-24 12:33:59 +0530 | [diff] [blame] | 179 | { |
| 180 | 'MESON_INSTALL_PREFIX': get_option('prefix'), |
Roger G. Coscojuela | 38b3b6f | 2025-04-16 15:58:00 +0200 | [diff] [blame] | 181 | 'BMCWEB_WATCHDOG_TIMEOUT_SECONDS': get_option( |
| 182 | 'watchdog-timeout-seconds', |
| 183 | ), |
rohitpai | cf9085a | 2025-02-24 12:33:59 +0530 | [diff] [blame] | 184 | }, |
Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 185 | ), |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 186 | ) |
Nan Zhou | 307386e | 2022-10-12 20:29:34 +0000 | [diff] [blame] | 187 | |
| 188 | # Copy pam-webserver to etc/pam.d |
Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 189 | install_data('pam-webserver', install_dir: '/etc/pam.d/', rename: 'webserver') |