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 | |
Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 53 | int_options = ['http-body-limit'] |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 54 | |
Ed Tanous | fe907df | 2024-05-07 16:37:09 -0700 | [diff] [blame] | 55 | feature_options_string = '\n//Feature options\n' |
| 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 | fe907df | 2024-05-07 16:37:09 -0700 | [diff] [blame] | 59 | foreach option_key : feature_options + string_options + int_options |
| 60 | option_key_config = 'BMCWEB_' + option_key.to_upper() |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 61 | option_key_config = option_key_config.replace('-', '_') |
| 62 | |
| 63 | message(option_key_config) |
Ed Tanous | fe907df | 2024-05-07 16:37:09 -0700 | [diff] [blame] | 64 | |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 65 | opt = get_option(option_key) |
| 66 | if string_options.contains(option_key) |
Ed Tanous | fe907df | 2024-05-07 16:37:09 -0700 | [diff] [blame] | 67 | string_options_string += 'constexpr std::string_view ' + option_key_config + ' = "' + opt + '";\n' |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 68 | elif int_options.contains(option_key) |
Ed Tanous | fe907df | 2024-05-07 16:37:09 -0700 | [diff] [blame] | 69 | int_options_string += 'constexpr const int ' + option_key_config + ' = ' + opt.to_string() + ';\n' |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 70 | else |
Ed Tanous | fe907df | 2024-05-07 16:37:09 -0700 | [diff] [blame] | 71 | feature_options_string += 'constexpr const bool ' + option_key_config + ' = ' + opt.allowed().to_string() + ';\n' |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 72 | opt = opt.allowed().to_string() |
| 73 | endif |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 74 | summary(option_key, opt, section: 'Features') |
| 75 | endforeach |
| 76 | |
Myung Bae | 662aa6e | 2023-01-10 14:20:28 -0600 | [diff] [blame] | 77 | # Logging level |
| 78 | loglvlopt = get_option('bmcweb-logging') |
| 79 | if get_option('buildtype').startswith('debug') and loglvlopt == 'disabled' |
Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 80 | # Override logging level as 'debug' if 'bmcweb-logging' is set as 'disabled' |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 81 | loglvlopt = 'debug' |
Myung Bae | 662aa6e | 2023-01-10 14:20:28 -0600 | [diff] [blame] | 82 | endif |
Ed Tanous | e7245fe | 2023-07-24 17:01:38 -0700 | [diff] [blame] | 83 | loglvlopt = loglvlopt.to_upper() |
Ed Tanous | fe907df | 2024-05-07 16:37:09 -0700 | [diff] [blame] | 84 | string_options_string += 'constexpr std::string_view BMCWEB_LOGGING_LEVEL' + ' = "' + loglvlopt + '";\n' |
| 85 | |
| 86 | # NBD proxy is disabled due to lack of maintenance. See meson_options.txt |
| 87 | feature_options_string += 'constexpr const bool BMCWEB_VM_NBDPROXY = false;\n' |
| 88 | |
| 89 | conf_data.set( |
| 90 | 'BMCWEB_OPTIONS', |
| 91 | string_options_string + int_options_string + feature_options_string, |
| 92 | ) |
Myung Bae | 662aa6e | 2023-01-10 14:20:28 -0600 | [diff] [blame] | 93 | |
Nan Zhou | 307386e | 2022-10-12 20:29:34 +0000 | [diff] [blame] | 94 | conf_h_dep = declare_dependency( |
| 95 | include_directories: include_directories('.'), |
| 96 | sources: configure_file( |
| 97 | input: 'bmcweb_config.h.in', |
| 98 | output: 'bmcweb_config.h', |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 99 | configuration: conf_data, |
| 100 | ), |
Nan Zhou | 307386e | 2022-10-12 20:29:34 +0000 | [diff] [blame] | 101 | ) |
| 102 | |
| 103 | # Configure and install systemd unit files |
Ed Tanous | 796ba93 | 2020-08-02 04:29:21 +0000 | [diff] [blame] | 104 | https_port = get_option('https_port') |
| 105 | if https_port > 0 |
| 106 | configure_file( |
| 107 | input: 'bmcweb.socket.in', |
| 108 | output: 'bmcweb.socket', |
| 109 | install_dir: systemd_system_unit_dir, |
| 110 | install: true, |
| 111 | configuration: configuration_data( |
| 112 | { |
| 113 | 'BMCWEB_PORT': https_port, |
| 114 | 'HTTP_LEVEL_ALLOWED': 'https', |
| 115 | 'HTTP_AUTH_LEVEL': 'auth', |
| 116 | 'HTTP_BIND': '', |
| 117 | }, |
| 118 | ), |
| 119 | ) |
| 120 | endif |
| 121 | |
| 122 | ports = get_option('additional-ports') |
| 123 | binds = get_option('additional-bind-to-device') |
Janet Adkins | 58d3aab | 2025-02-19 14:45:43 -0600 | [diff] [blame] | 124 | auths = get_option('additional-auth') |
Ed Tanous | 796ba93 | 2020-08-02 04:29:21 +0000 | [diff] [blame] | 125 | foreach index : range(ports.length()) |
| 126 | port_number = ports[index] |
| 127 | bind_to_device = '0.0.0.0' |
| 128 | auth = 'auth' |
| 129 | if index < binds.length() |
Janet Adkins | 58d3aab | 2025-02-19 14:45:43 -0600 | [diff] [blame] | 130 | bind_to_device = binds[index] |
Ed Tanous | 796ba93 | 2020-08-02 04:29:21 +0000 | [diff] [blame] | 131 | endif |
| 132 | |
Janet Adkins | 58d3aab | 2025-02-19 14:45:43 -0600 | [diff] [blame] | 133 | if index < auths.length() |
| 134 | auth = auths[index] |
Ed Tanous | 796ba93 | 2020-08-02 04:29:21 +0000 | [diff] [blame] | 135 | endif |
| 136 | |
Janet Adkins | 58d3aab | 2025-02-19 14:45:43 -0600 | [diff] [blame] | 137 | filename = 'bmcweb_' + port_number |
Ed Tanous | 796ba93 | 2020-08-02 04:29:21 +0000 | [diff] [blame] | 138 | configure_file( |
| 139 | input: 'bmcweb.socket.in', |
| 140 | output: filename, |
| 141 | install_dir: systemd_system_unit_dir, |
| 142 | install: true, |
| 143 | configuration: configuration_data( |
| 144 | { |
| 145 | 'BMCWEB_HTTPS_PORT': port_number, |
| 146 | 'HTTP_LEVEL_ALLOWED': 'https', |
Janet Adkins | 58d3aab | 2025-02-19 14:45:43 -0600 | [diff] [blame] | 147 | 'HTTP_BIND': bind_to_device, |
Ed Tanous | 796ba93 | 2020-08-02 04:29:21 +0000 | [diff] [blame] | 148 | 'HTTP_AUTH_LEVEL': auth, |
| 149 | }, |
| 150 | ), |
| 151 | ) |
| 152 | endforeach |
Nan Zhou | 307386e | 2022-10-12 20:29:34 +0000 | [diff] [blame] | 153 | |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 154 | configure_file( |
| 155 | input: 'bmcweb.service.in', |
| 156 | output: 'bmcweb.service', |
| 157 | install_dir: systemd_system_unit_dir, |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 158 | install: true, |
Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 159 | configuration: configuration_data( |
| 160 | {'MESON_INSTALL_PREFIX': get_option('prefix')}, |
| 161 | ), |
Ed Tanous | f2caadc | 2024-01-02 18:34:36 -0800 | [diff] [blame] | 162 | ) |
Nan Zhou | 307386e | 2022-10-12 20:29:34 +0000 | [diff] [blame] | 163 | |
| 164 | # Copy pam-webserver to etc/pam.d |
Ed Tanous | 92e26be | 2024-08-21 13:39:14 -0700 | [diff] [blame] | 165 | install_data('pam-webserver', install_dir: '/etc/pam.d/', rename: 'webserver') |