Merge pull request #23951 from aochsner/feature/elastic-optional
make elasticsearch provider optional if search.elasticsearch not defined
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-search-backend-module-elasticsearch': minor
|
||||
---
|
||||
|
||||
When using the New Backend System, the Elasticsearch provider will only be added if the `search.elasticsearch` config section exists.
|
||||
@@ -68,6 +68,15 @@ export default createBackendModule({
|
||||
config: coreServices.rootConfig,
|
||||
},
|
||||
async init({ searchEngineRegistry, logger, config }) {
|
||||
const baseKey = 'search.elasticsearch';
|
||||
const baseConfig = config.getOptional(baseKey);
|
||||
if (!baseConfig) {
|
||||
logger.warn(
|
||||
'No configuration found under "search.elasticsearch" key. Skipping search engine inititalization.',
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
searchEngineRegistry.setSearchEngine(
|
||||
await ElasticSearchSearchEngine.fromConfig({
|
||||
logger,
|
||||
|
||||
Reference in New Issue
Block a user