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