Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
mpotter CreditAttribution: mpotter commentedEach module is responsible for it's own output/export format. So this probably needs to be done within search_api itself.
Comment #2
kenorb CreditAttribution: kenorb commentedThanks 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.
Comment #3
kenorb CreditAttribution: kenorb commented#2688749: Provide a way to not export certain properties of a component