MINOR: WURFL: do not emit warnings when not configured

At the moment the WURFL module emits 3 lines of warnings upon startup
when it is not referenced in the configuration file, which is quite
confusing. Let's make sure to keep it silent when not configured, as
detected by the absence of the wurfl-data-file statement.
This commit is contained in:
Willy Tarreau 2019-05-22 14:01:22 +02:00
parent ae4fcf1e67
commit aabbe6a3bb

View File

@ -260,6 +260,11 @@ static int ha_wurfl_init(void)
int wurfl_result_code = WURFL_OK; int wurfl_result_code = WURFL_OK;
int len; int len;
// wurfl-data-file not configured, WURFL is not used so don't try to
// configure it.
if (global_wurfl.data_file == NULL)
return 0;
ha_notice("WURFL: Loading module v.%s\n", HA_WURFL_MODULE_VERSION); ha_notice("WURFL: Loading module v.%s\n", HA_WURFL_MODULE_VERSION);
// creating WURFL handler // creating WURFL handler
global_wurfl.handle = wurfl_create(); global_wurfl.handle = wurfl_create();
@ -272,11 +277,6 @@ static int ha_wurfl_init(void)
ha_notice("WURFL: Engine handler created - API version %s\n", wurfl_get_api_version() ); ha_notice("WURFL: Engine handler created - API version %s\n", wurfl_get_api_version() );
// set wurfl data file // set wurfl data file
if (global_wurfl.data_file == NULL) {
ha_warning("WURFL: missing wurfl-data-file parameter in global configuration\n");
return ERR_WARN;
}
if (wurfl_set_root(global_wurfl.handle, global_wurfl.data_file) != WURFL_OK) { if (wurfl_set_root(global_wurfl.handle, global_wurfl.data_file) != WURFL_OK) {
ha_warning("WURFL: Engine setting root file failed - %s\n", wurfl_get_error_message(global_wurfl.handle)); ha_warning("WURFL: Engine setting root file failed - %s\n", wurfl_get_error_message(global_wurfl.handle));
return ERR_WARN; return ERR_WARN;