backend: add UrlReader
This commit is contained in:
@@ -32,6 +32,7 @@ import {
|
||||
useHotMemoize,
|
||||
notFoundHandler,
|
||||
SingleHostDiscovery,
|
||||
UrlReaders,
|
||||
} from '@backstage/backend-common';
|
||||
import { ConfigReader, AppConfig } from '@backstage/config';
|
||||
import healthcheck from './plugins/healthcheck';
|
||||
@@ -60,8 +61,9 @@ function makeCreateEnv(loadedConfigs: AppConfig[]) {
|
||||
},
|
||||
},
|
||||
);
|
||||
const reader = UrlReaders.default({ logger }).createWithConfig(config);
|
||||
const discovery = SingleHostDiscovery.fromConfig(config);
|
||||
return { logger, database, config, discovery };
|
||||
return { logger, database, config, reader, discovery };
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -28,10 +28,11 @@ import { useHotCleanup } from '@backstage/backend-common';
|
||||
|
||||
export default async function createPlugin({
|
||||
logger,
|
||||
database,
|
||||
config,
|
||||
reader,
|
||||
database,
|
||||
}: PluginEnvironment) {
|
||||
const locationReader = new LocationReaders({ logger, config });
|
||||
const locationReader = new LocationReaders({ logger, reader, config });
|
||||
|
||||
const db = await DatabaseManager.createDatabase(database, { logger });
|
||||
const entitiesCatalog = new DatabaseEntitiesCatalog(db);
|
||||
|
||||
@@ -17,11 +17,12 @@
|
||||
import Knex from 'knex';
|
||||
import { Logger } from 'winston';
|
||||
import { Config } from '@backstage/config';
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
import { PluginEndpointDiscovery, UrlReader } from '@backstage/backend-common';
|
||||
|
||||
export type PluginEnvironment = {
|
||||
logger: Logger;
|
||||
database: Knex;
|
||||
config: Config;
|
||||
reader: UrlReader;
|
||||
discovery: PluginEndpointDiscovery;
|
||||
};
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
useHotMemoize,
|
||||
notFoundHandler,
|
||||
SingleHostDiscovery,
|
||||
UrlReaders,
|
||||
} from '@backstage/backend-common';
|
||||
import { ConfigReader, AppConfig } from '@backstage/config';
|
||||
import auth from './plugins/auth';
|
||||
@@ -38,8 +39,9 @@ function makeCreateEnv(loadedConfigs: AppConfig[]) {
|
||||
},
|
||||
},
|
||||
);
|
||||
const reader = UrlReaders.default({ logger }).createWithConfig(config);
|
||||
const discovery = SingleHostDiscovery.fromConfig(config);
|
||||
return { logger, database, config, discovery };
|
||||
return { logger, database, config, reader, discovery };
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,10 @@ import { useHotCleanup } from '@backstage/backend-common';
|
||||
export default async function createPlugin({
|
||||
logger,
|
||||
config,
|
||||
reader,
|
||||
database,
|
||||
}: PluginEnvironment) {
|
||||
const locationReader = new LocationReaders({ logger, config });
|
||||
const locationReader = new LocationReaders({ logger, reader, config });
|
||||
|
||||
const db = await DatabaseManager.createDatabase(database, { logger });
|
||||
const entitiesCatalog = new DatabaseEntitiesCatalog(db);
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import Knex from 'knex';
|
||||
import { Logger } from 'winston';
|
||||
import { Config } from '@backstage/config';
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
import { PluginEndpointDiscovery, UrlReader } from '@backstage/backend-common';
|
||||
|
||||
export type PluginEnvironment = {
|
||||
logger: Logger;
|
||||
database: Knex;
|
||||
config: Config;
|
||||
reader: UrlReader
|
||||
discovery: PluginEndpointDiscovery;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user