Problem/Motivation

Hey.
We work with different environments (local, dev, stage, prod) and have different solr-servers for each environment. To maintain the correct relation between environment and server we tried to override the server-property of each index within settings.php (different on each environment):

<?php
$config['search_api.index.plant_index']['server'] = 'dev';
?>

In the exported configuration the server is set to the production server.
Looking on /admin/config/search/search-api everything seems as expected: the indexes are grouped into the environment-specific server. But if you try to index items or search something, the production server is queried.

Debugging lead me to the parameter used in the routes of SearchAPI: every parameter used there ("search_api_server" and "search_api_index") are loaded by the AdminPathConfigEntityConverter which loads the entity without any overrides.

Proposed resolution

Add with_config_overrides: TRUE to every route using the needed parameters.

Maybe this also fixes #2670372: Index settings do not synchronize across environments, I couldn't test this yet.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stBorchert created an issue. See original summary.

stBorchert’s picture

Patching late at night is not always the best.
We do *not* want to load the overridden config while editing a server or an index. This would be bad.
On "delete" we need the override because of the pre-/post-delete hooks so we clear the correct index on the correct server.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

I think this looks good.

Alumei’s picture

Alumei’s picture

drunken monkey’s picture

Status: Reviewed & tested by the community » Closed (duplicate)

As Alumei correctly says, there are already two issues for this – one too many, probably. Please help solve this problem in either of the other ones, and please search for existing issues next time before creating a new one!