-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SolrPower_Api->get_server_info returns inaccurate server information #408
Comments
That'd be great, thanks! |
I know there's a PR for this right now, but since it hasn't been approved yet, here's another option to solve this: public function get_server_info() {
$connection_options = apply_filters('s4wp_connection_options', [
'endpoint' => [
'localhost' => [
'host' => getenv( 'PANTHEON_INDEX_HOST' ),
'port' => getenv( 'PANTHEON_INDEX_PORT' ),
'path' => $this->compute_path()
]
]
]);
$server_info = [
'ping_status' => $this->ping_server(),
'ip_address' => $connection_options['endpoint']['localhost']['host'],
'port' => $connection_options['endpoint']['localhost']['port'],
'path' => $connection_options['endpoint']['localhost']['path'],
];
return $server_info;
} |
I was tinkering with code trying to get a slightly better understanding of things as well and one possible way is also by changing the function to something like: public function get_server_info() {
return array(
'ping_status' => $this->ping_server(),
'ip_address' => $this->get_solr()->getEndpoint('localhost')->getHost(),
'port' => $this->get_solr()->getEndpoint('localhost')->getPort(),
'path' => $this->compute_path(),
);
} This would also mean changing the $host = getenv( 'PANTHEON_INDEX_HOST' ) ? getenv( 'PANTHEON_INDEX_HOST' ) : null;
$port = getenv( 'PANTHEON_INDEX_PORT' ) ? getenv( 'PANTHEON_INDEX_PORT' ) : null;
$solarium_config = array(
'endpoint' => array(
'localhost' => array(
'host' => apply_filters( 'solr_power_hostname', $host ),
'port' => apply_filters( 'solr_power_port', $port ),
'scheme' => $this->get_default_scheme(),
'path' => $this->compute_path(),
'ssl' => array(
'local_cert' => self::get_cert_path(),
),
),
),
); Or just not have those |
https://github.com/pantheon-systems/solr-power/blob/master/includes/class-solrpower-api.php#L575-L584
get_server_info()
assumes that the host name and port are the pantheon environmental variables, but it's possible to override the connection data via filters and constants.(I'll try to get a PR out for this this week if I can.)
The text was updated successfully, but these errors were encountered: