Skip to content
Snippets Groups Projects
Commit ab2591f8 authored by ale's avatar ale
Browse files

Allow overriding host for local copy of the global database

Some testing scenarios (e.g. when testing containers using podman
services) require using a different host for the "local" instance.
parent e68d8a91
Branches master
Tags v0.1.9
No related merge requests found
Pipeline #85251 passed
......@@ -49,9 +49,16 @@ function noblogs_load_global_dataset() {
global $wpdb;
global $noblogs_config;
$master = $noblogs_config['db_config']['master'];
// IP adress of the local mysql instance with the 'master' db.
// We want to override this in certain testing scenarios, to use
// a mysql server not on localhost.
$local_master_host = '127.0.0.1';
if (isset($master['local_host'])) {
$local_master_host = $master['local_host'];
}
if ($noblogs_config['db_config']['is_master']) {
$wpdb->add_database(array(
"host" => "127.0.0.1:" . $master['port'],
"host" => $local_master_host . ":" . $master['port'],
"user" => $master['user'],
"password" => $master['password'],
"name" => $master['name'],
......@@ -72,7 +79,7 @@ function noblogs_load_global_dataset() {
"timeout" => 2
));
$wpdb->add_database(array(
"host" => "127.0.0.1:" . $master['port'],
"host" => $local_master_host . ":" . $master['port'],
"user" => $master['user'],
"password" => $master['password'],
"name" => $master['name'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment