Skip to content

Commit

Permalink
CMSP-789: Config XML (#176)
Browse files Browse the repository at this point in the history
CMSP-789: Resolves issue with solrconfig.xml
  • Loading branch information
rwagner00 authored Mar 6, 2024
1 parent 05a94eb commit 269ff78
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"ext-curl": "*",
"ext-json": "*",
"ext-zip": "*",
"drupal/search_api_solr": "^4.2",
"drupal/search_api_solr": "^4.3",
"guzzlehttp/guzzle": "^6.5.7|^7.5",
"http-interop/http-factory-guzzle": "^1.0",
"kint-php/kint": "^4.1",
Expand Down
6 changes: 6 additions & 0 deletions src/EventSubscriber/SearchApiPantheonSolrConfigFilesAlter.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ final class SearchApiPantheonSolrConfigFilesAlter implements EventSubscriberInte
*/
public function onPostConfigFilesGenerationEvent(PostConfigFilesGenerationEvent $event): void {
$files = $event->getConfigFiles();

// Append at the end of the file.
$solrcore_properties = explode(PHP_EOL, $files['solrcore.properties']);
// Remove the solr.install.dir if it exists
Expand All @@ -36,6 +37,11 @@ public function onPostConfigFilesGenerationEvent(PostConfigFilesGenerationEvent
// This file is causing undue issues with core restarts
unset($files['solrcore.properties']);

$install_dir = isset($_ENV['PANTHEON_SOLR_INSTALL_DIR']) ? $_ENV['PANTHEON_SOLR_INSTALL_DIR'] : "/opt/solr/";

$files['solrconfig.xml'] = str_replace("solr.install.dir:../../../..",
"solr.install.dir:" . $install_dir, $files['solrconfig.xml']);

$event->setConfigFiles($files);
}

Expand Down

0 comments on commit 269ff78

Please sign in to comment.