1# Gather the Configuration data 2 3conf_data = configuration_data() 4 5feature_options = [ 6 'basic-auth', 7 'cookie-auth', 8 'experimental-redfish-dbus-log-subscription', 9 'experimental-redfish-multi-computer-system', 10 'google-api', 11 'host-serial-socket', 12 'http-zstd', 13 'http2', 14 'hypervisor-computer-system', 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', 22 'kvm', 23 'mutual-tls-auth', 24 'redfish', 25 'redfish-aggregation', 26 'redfish-allow-deprecated-indicatorled', 27 'redfish-allow-deprecated-power-thermal', 28 'redfish-allow-simple-update', 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', 37 'redfish-updateservice-use-dbus', 38 'redfish-use-3-digit-messageid', 39 'redfish-use-hardcoded-system-location-indicator', 40 'rest', 41 'session-auth', 42 'static-hosting', 43 'tests', 44 'vm-websocket', 45 'xtoken-auth', 46] 47 48string_options = [ 49 'dns-resolver', 50 'mutual-tls-common-name-parsing-default', 51 'redfish-manager-uri-name', 52 'redfish-system-uri-name', 53] 54 55int_options = ['http-body-limit', 'watchdog-timeout-seconds'] 56 57feature_options_string = '\n// Feature options\n' 58string_options_string = '\n// String options\n' 59int_options_string = '\n// Integer options\n' 60 61 62foreach feature_type, feature_list : { 63 'Feature': feature_options, 64 'Numeric': int_options, 65 'String': string_options, 66} 67 summary_dict = {} 68 foreach option_key : feature_list 69 option_key_config = 'BMCWEB_' + option_key.to_upper() 70 option_key_config = option_key_config.replace('-', '_') 71 72 opt = get_option(option_key) 73 if feature_type == 'Feature' 74 opt = opt.allowed() 75 feature_options_string += 'constexpr const bool @0@=@1@;\n'.format( 76 option_key_config, 77 opt.to_string(), 78 ) 79 endif 80 if feature_type == 'Numeric' 81 int_options_string += 'constexpr const int @0@=@1@;\n'.format( 82 option_key_config, 83 opt.to_string(), 84 ) 85 endif 86 if feature_type == 'String' 87 string_options_string += 'constexpr std::string_view @0@="@1@";\n'.format( 88 option_key_config, 89 opt, 90 ) 91 endif 92 summary_dict += {option_key: opt} 93 endforeach 94 summary(summary_dict, section: feature_type + ' Options', bool_yn: true) 95endforeach 96 97# Logging level 98loglvlopt = get_option('bmcweb-logging') 99if get_option('buildtype').startswith('debug') and loglvlopt == 'disabled' 100 # Override logging level as 'debug' if 'bmcweb-logging' is set as 'disabled' 101 loglvlopt = 'debug' 102endif 103loglvlopt = loglvlopt.to_upper() 104string_options_string += 'constexpr std::string_view BMCWEB_LOGGING_LEVEL' + ' = "' + loglvlopt + '";\n' 105 106# NBD proxy is disabled due to lack of maintenance. See meson_options.txt 107feature_options_string += 'constexpr const bool BMCWEB_VM_NBDPROXY = false;\n' 108 109conf_data.set( 110 'BMCWEB_OPTIONS', 111 string_options_string + int_options_string + feature_options_string, 112) 113 114conf_h_dep = declare_dependency( 115 include_directories: include_directories('.'), 116 sources: configure_file( 117 input: 'bmcweb_config.h.in', 118 output: 'bmcweb_config.h', 119 configuration: conf_data, 120 ), 121) 122 123# Configure and install systemd unit files 124https_port = get_option('https_port') 125if https_port > 0 126 configure_file( 127 input: 'bmcweb.socket.in', 128 output: 'bmcweb.socket', 129 install_dir: systemd_system_unit_dir, 130 install: true, 131 configuration: configuration_data( 132 { 133 'BMCWEB_PORT': https_port, 134 'HTTP_LEVEL_ALLOWED': 'https', 135 'HTTP_AUTH_LEVEL': 'auth', 136 'HTTP_BIND': '', 137 }, 138 ), 139 ) 140endif 141 142ports = get_option('additional-ports') 143binds = get_option('additional-bind-to-device') 144auths = get_option('additional-auth') 145foreach index : range(ports.length()) 146 port_number = ports[index] 147 bind_to_device = '0.0.0.0' 148 auth = 'auth' 149 if index < binds.length() 150 bind_to_device = binds[index] 151 endif 152 153 if index < auths.length() 154 auth = auths[index] 155 endif 156 157 filename = 'bmcweb_' + port_number + '.socket' 158 configure_file( 159 input: 'bmcweb.socket.in', 160 output: filename, 161 install_dir: systemd_system_unit_dir, 162 install: true, 163 configuration: configuration_data( 164 { 165 'BMCWEB_PORT': port_number, 166 'HTTP_LEVEL_ALLOWED': 'https', 167 'HTTP_BIND': bind_to_device, 168 'HTTP_AUTH_LEVEL': auth, 169 }, 170 ), 171 ) 172endforeach 173 174configure_file( 175 input: 'bmcweb.service.in', 176 output: 'bmcweb.service', 177 install_dir: systemd_system_unit_dir, 178 install: true, 179 configuration: configuration_data( 180 { 181 'MESON_INSTALL_PREFIX': get_option('prefix'), 182 'BMCWEB_WATCHDOG_TIMEOUT_SECONDS': get_option( 183 'watchdog-timeout-seconds', 184 ), 185 }, 186 ), 187) 188 189# Copy pam-webserver to etc/pam.d 190install_data('pam-webserver', install_dir: '/etc/pam.d/', rename: 'webserver') 191