From 8f6a17c04c37748d07553003d075fb4d939737e9 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Wed, 14 Apr 2021 09:53:16 +0200 Subject: [PATCH] Add experimental option to start the new catalog Signed-off-by: Johan Haals --- packages/backend/src/plugins/catalog.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/backend/src/plugins/catalog.ts b/packages/backend/src/plugins/catalog.ts index 076840944f..99ba769736 100644 --- a/packages/backend/src/plugins/catalog.ts +++ b/packages/backend/src/plugins/catalog.ts @@ -18,6 +18,7 @@ import { useHotCleanup } from '@backstage/backend-common'; import { CatalogBuilder, createRouter, + NextCatalogBuilder, runPeriodically, } from '@backstage/plugin-catalog-backend'; import { Router } from 'express'; @@ -26,6 +27,28 @@ import { PluginEnvironment } from '../types'; export default async function createPlugin( env: PluginEnvironment, ): Promise { + // HIGHLY experimental rework of the software catalog + if (process.env.EXPERIMENTAL_CATALOG === '1') { + const builder = new NextCatalogBuilder(env); + const { + entitiesCatalog, + locationsCatalog, + locationAnalyzer, + processingEngine, + } = await builder.build(); + + // TODO(jhaals): run and manage in background. + processingEngine.start(); + + return await createRouter({ + entitiesCatalog, + locationsCatalog, + locationAnalyzer, + logger: env.logger, + config: env.config, + }); + } + const builder = new CatalogBuilder(env); const { entitiesCatalog,