I've the following export provided by search_api_solr:

/**
 * Implements hook_default_search_api_server().
 */
function hook_default_search_api_server() {
  $items = array();
  $items['foo_search_server'] = entity_import('search_api_server', '{
    "name" : "Foo Search Server",
    "machine_name" : "foo_search_server",
    "class" : "search_api_solr_service",
    "options" : {
      "scheme" : "http",
      "host" : "localhost",
      "port" : "8983",
      "path" : "\\/solr",
      "http_user" : "SOLR_USER",
      "http_pass" : "MY_SECRET_PASS",
    },
    "enabled" : "1"
  }');
  return $items;
}

Which hook I can use to alter and exclude from exporting http_user and http_pass?

I've looked into hook_features_export_alter in features.api.php, but it says:

The Components' actual data, however, cannot be altered by this hook

Comments

mpotter’s picture

Each module is responsible for it's own output/export format. So this probably needs to be done within search_api itself.

kenorb’s picture

Thanks for reply. It's possible that such as hook can be implemented in Features so 3rd party modules can alter the exported data? Or it'll cause some problems?

In my case it's not only about password and it's privacy, but working with such a feature where passwords are different on different environments and that feature would be always Overridden.

As for workaround specifically for Search API, this module can be handy: Search API Override or Search API Solr Overrides which overrides settings in settings file it-self.

kenorb’s picture