Skip to content
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

[CMSI 598] - Removing binding.pem from php container and using mtlsproxyhost for search-gateway {Wordpress Site} #635

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions includes/class-pantheoncurl.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Solr_Power
*/

use Solarium\Core\Client\Adapter\Curl as Curl;
use Solarium\Core\Client\Adapter\Curl;

/**
* Override Solarium so that more options can be set before executing curl.
Expand All @@ -23,8 +23,12 @@ public function createHandle( $request, $endpoint ) {
$handler = parent::createHandle( $request, $endpoint );
if ( defined( 'PANTHEON_ENVIRONMENT' ) ) {
curl_setopt( $handler, CURLOPT_SSL_VERIFYPEER, false );
$client_cert = $_SERVER['HOME'] . '/certs/binding.pem';
curl_setopt( $handler, CURLOPT_SSLCERT, $client_cert );
if ( getenv( 'JOB_RUNTIME' ) !== 'UJR' && getenv( 'MTLSPROXY_ENABLED' ) === 'true' ) {
curl_setopt( $handler, CURLOPT_SSL_VERIFYHOST, 0 );
} else {
$client_cert = $_SERVER['HOME'] . '/certs/binding.pem';
curl_setopt( $handler, CURLOPT_SSLCERT, $client_cert );
}
}

return $handler;
Expand Down
12 changes: 6 additions & 6 deletions includes/class-solrpower-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function submit_schema() {
}

$path = $this->compute_path();
$url = $this->get_default_scheme() . '://' . getenv( 'PANTHEON_INDEX_HOST' ) . ':' . getenv( 'PANTHEON_INDEX_PORT' ) . $path;
$url = $this->get_default_scheme() . '://' . getenv( 'INDEX_PROXY_HOST' ) . ':' . getenv( 'INDEX_PROXY_PORT' ) . $path;
$client_cert = self::get_cert_path();

/*
Expand All @@ -139,7 +139,7 @@ function submit_schema() {
// set URL and other appropriate options.
$opts = array(
CURLOPT_URL => $url,
CURLOPT_PORT => getenv( 'PANTHEON_INDEX_PORT' ),
CURLOPT_PORT => getenv( 'INDEX_PROXY_PORT' ),
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_SSLCERT => $client_cert,
CURLOPT_SSL_VERIFYPEER => false,
Expand Down Expand Up @@ -220,8 +220,8 @@ function get_solr() {
$solarium_config = array(
'endpoint' => array(
'localhost' => array(
'host' => getenv( 'PANTHEON_INDEX_HOST' ),
'port' => getenv( 'PANTHEON_INDEX_PORT' ),
'host' => getenv( 'INDEX_PROXY_HOST' ),
'port' => getenv( 'INDEX_PROXY_PORT' ),
'scheme' => $this->get_default_scheme(),
'path' => $this->compute_path(),
'ssl' => array(
Expand Down Expand Up @@ -605,8 +605,8 @@ public function get_server_info() {

return array(
'ping_status' => $ping,
'ip_address' => getenv( 'PANTHEON_INDEX_HOST' ),
'port' => getenv( 'PANTHEON_INDEX_PORT' ),
'ip_address' => getenv( 'INDEX_PROXY_HOST' ),
'port' => getenv( 'INDEX_PROXY_PORT' ),
'path' => $this->compute_path(),
);

Expand Down
Loading