blob: c69b789ae1c86c6ce942f4d65c8b952c5eee7986 [file] [log] [blame]
Nan Zhou307386e2022-10-12 20:29:34 +00001# Gather the Configuration data
2
3conf_data = configuration_data()
Ed Tanous25b54db2024-04-17 15:40:31 -07004
5feature_options = [
6 'basic-auth',
7 'cookie-auth',
Alexander Hansen6c58a032024-11-21 15:27:04 -08008 'experimental-redfish-dbus-log-subscription',
Ed Tanousf4225d72025-02-20 14:56:15 -08009 'experimental-redfish-multi-computer-system',
Ed Tanous25b54db2024-04-17 15:40:31 -070010 'google-api',
11 'host-serial-socket',
Ed Tanous39fe3af2025-02-17 11:34:12 -080012 'http2',
Gunnar Mills68896202024-08-21 11:34:20 -050013 'hypervisor-computer-system',
Ed Tanous25b54db2024-04-17 15:40:31 -070014 '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 Tanous25b54db2024-04-17 15:40:31 -070021 'kvm',
22 'mutual-tls-auth',
Ed Tanousf4225d72025-02-20 14:56:15 -080023 'redfish',
Ed Tanous25b54db2024-04-17 15:40:31 -070024 'redfish-aggregation',
25 'redfish-allow-deprecated-power-thermal',
Ed Tanous6a371402024-12-03 14:01:25 -080026 'redfish-allow-simple-update',
Ed Tanous25b54db2024-04-17 15:40:31 -070027 'redfish-bmc-journal',
28 'redfish-cpu-log',
29 'redfish-dbus-log',
30 'redfish-dump-log',
31 'redfish-host-logger',
32 'redfish-new-powersubsystem-thermalsubsystem',
33 'redfish-oem-manager-fan-data',
34 'redfish-provisioning-feature',
Jagpal Singh Gill57855662024-04-17 10:44:27 -070035 'redfish-updateservice-use-dbus',
Ed Tanousf4225d72025-02-20 14:56:15 -080036 'redfish-use-3-digit-messageid',
Ed Tanous25b54db2024-04-17 15:40:31 -070037 'rest',
38 'session-auth',
39 'static-hosting',
40 'tests',
41 'vm-websocket',
42 'xtoken-auth',
43]
44
45string_options = [
46 'dns-resolver',
Ed Tanous3ce36882024-06-09 10:58:16 -070047 'mutual-tls-common-name-parsing-default',
Ed Tanous253f11b2024-05-16 09:38:31 -070048 'redfish-manager-uri-name',
49 'redfish-system-uri-name',
Ed Tanous25b54db2024-04-17 15:40:31 -070050]
51
rohitpaicf9085a2025-02-24 12:33:59 +053052int_options = ['http-body-limit', 'watchdog-timeout-seconds']
Ed Tanous25b54db2024-04-17 15:40:31 -070053
Ed Tanous7e5e98d2025-03-12 10:34:24 -070054feature_options_string = '\n// Feature options\n'
Ed Tanousfe907df2024-05-07 16:37:09 -070055string_options_string = '\n// String options\n'
56int_options_string = '\n// Integer options\n'
Ed Tanous25b54db2024-04-17 15:40:31 -070057
Ed Tanous25b54db2024-04-17 15:40:31 -070058
Ed Tanous7e5e98d2025-03-12 10:34:24 -070059foreach feature_type, feature_list : {
60 'Feature': feature_options,
61 'Numeric': int_options,
62 'String': string_options,
63}
64 summary_dict = {}
65 foreach option_key : feature_list
66 option_key_config = 'BMCWEB_' + option_key.to_upper()
67 option_key_config = option_key_config.replace('-', '_')
Ed Tanousfe907df2024-05-07 16:37:09 -070068
Ed Tanous7e5e98d2025-03-12 10:34:24 -070069 opt = get_option(option_key)
70 if feature_type == 'Feature'
71 opt = opt.allowed()
72 feature_options_string += 'constexpr const bool @0@=@1@;\n'.format(
73 option_key_config,
74 opt.to_string(),
75 )
76 endif
77 if feature_type == 'Numeric'
78 int_options_string += 'constexpr const int @0@=@1@;\n'.format(
79 option_key_config,
80 opt.to_string(),
81 )
82 endif
83 if feature_type == 'String'
84 string_options_string += 'constexpr std::string_view @0@="@1@";\n'.format(
85 option_key_config,
86 opt,
87 )
88 endif
89 summary_dict += {option_key: opt}
90 endforeach
91 summary(summary_dict, section: feature_type + ' Options', bool_yn: true)
Ed Tanous25b54db2024-04-17 15:40:31 -070092endforeach
93
Myung Bae662aa6e2023-01-10 14:20:28 -060094# Logging level
95loglvlopt = get_option('bmcweb-logging')
96if get_option('buildtype').startswith('debug') and loglvlopt == 'disabled'
Ed Tanous25b54db2024-04-17 15:40:31 -070097 # Override logging level as 'debug' if 'bmcweb-logging' is set as 'disabled'
Ed Tanousf2caadc2024-01-02 18:34:36 -080098 loglvlopt = 'debug'
Myung Bae662aa6e2023-01-10 14:20:28 -060099endif
Ed Tanouse7245fe2023-07-24 17:01:38 -0700100loglvlopt = loglvlopt.to_upper()
Ed Tanousfe907df2024-05-07 16:37:09 -0700101string_options_string += 'constexpr std::string_view BMCWEB_LOGGING_LEVEL' + ' = "' + loglvlopt + '";\n'
102
103# NBD proxy is disabled due to lack of maintenance. See meson_options.txt
Ed Tanous7e5e98d2025-03-12 10:34:24 -0700104feature_options_string += 'constexpr const bool BMCWEB_VM_NBDPROXY = false;\n'
Ed Tanousfe907df2024-05-07 16:37:09 -0700105
106conf_data.set(
107 'BMCWEB_OPTIONS',
108 string_options_string + int_options_string + feature_options_string,
109)
Myung Bae662aa6e2023-01-10 14:20:28 -0600110
Nan Zhou307386e2022-10-12 20:29:34 +0000111conf_h_dep = declare_dependency(
112 include_directories: include_directories('.'),
113 sources: configure_file(
114 input: 'bmcweb_config.h.in',
115 output: 'bmcweb_config.h',
Ed Tanousf2caadc2024-01-02 18:34:36 -0800116 configuration: conf_data,
117 ),
Nan Zhou307386e2022-10-12 20:29:34 +0000118)
119
120# Configure and install systemd unit files
Ed Tanous796ba932020-08-02 04:29:21 +0000121https_port = get_option('https_port')
122if https_port > 0
123 configure_file(
124 input: 'bmcweb.socket.in',
125 output: 'bmcweb.socket',
126 install_dir: systemd_system_unit_dir,
127 install: true,
128 configuration: configuration_data(
129 {
130 'BMCWEB_PORT': https_port,
131 'HTTP_LEVEL_ALLOWED': 'https',
132 'HTTP_AUTH_LEVEL': 'auth',
133 'HTTP_BIND': '',
134 },
135 ),
136 )
137endif
138
139ports = get_option('additional-ports')
140binds = get_option('additional-bind-to-device')
Janet Adkins58d3aab2025-02-19 14:45:43 -0600141auths = get_option('additional-auth')
Ed Tanous796ba932020-08-02 04:29:21 +0000142foreach index : range(ports.length())
143 port_number = ports[index]
144 bind_to_device = '0.0.0.0'
145 auth = 'auth'
146 if index < binds.length()
Janet Adkins58d3aab2025-02-19 14:45:43 -0600147 bind_to_device = binds[index]
Ed Tanous796ba932020-08-02 04:29:21 +0000148 endif
149
Janet Adkins58d3aab2025-02-19 14:45:43 -0600150 if index < auths.length()
151 auth = auths[index]
Ed Tanous796ba932020-08-02 04:29:21 +0000152 endif
153
Janet Adkins58d3aab2025-02-19 14:45:43 -0600154 filename = 'bmcweb_' + port_number
Ed Tanous796ba932020-08-02 04:29:21 +0000155 configure_file(
156 input: 'bmcweb.socket.in',
157 output: filename,
158 install_dir: systemd_system_unit_dir,
159 install: true,
160 configuration: configuration_data(
161 {
162 'BMCWEB_HTTPS_PORT': port_number,
163 'HTTP_LEVEL_ALLOWED': 'https',
Janet Adkins58d3aab2025-02-19 14:45:43 -0600164 'HTTP_BIND': bind_to_device,
Ed Tanous796ba932020-08-02 04:29:21 +0000165 'HTTP_AUTH_LEVEL': auth,
166 },
167 ),
168 )
169endforeach
Nan Zhou307386e2022-10-12 20:29:34 +0000170
Ed Tanousf2caadc2024-01-02 18:34:36 -0800171configure_file(
172 input: 'bmcweb.service.in',
173 output: 'bmcweb.service',
174 install_dir: systemd_system_unit_dir,
Ed Tanousf2caadc2024-01-02 18:34:36 -0800175 install: true,
Ed Tanous92e26be2024-08-21 13:39:14 -0700176 configuration: configuration_data(
rohitpaicf9085a2025-02-24 12:33:59 +0530177 {
178 'MESON_INSTALL_PREFIX': get_option('prefix'),
Roger G. Coscojuela38b3b6f2025-04-16 15:58:00 +0200179 'BMCWEB_WATCHDOG_TIMEOUT_SECONDS': get_option(
180 'watchdog-timeout-seconds',
181 ),
rohitpaicf9085a2025-02-24 12:33:59 +0530182 },
Ed Tanous92e26be2024-08-21 13:39:14 -0700183 ),
Ed Tanousf2caadc2024-01-02 18:34:36 -0800184)
Nan Zhou307386e2022-10-12 20:29:34 +0000185
186# Copy pam-webserver to etc/pam.d
Ed Tanous92e26be2024-08-21 13:39:14 -0700187install_data('pam-webserver', install_dir: '/etc/pam.d/', rename: 'webserver')