Skip to content

Commit

Permalink
do not modify the backend yet
Browse files Browse the repository at this point in the history
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
  • Loading branch information
freben committed Nov 11, 2021
1 parent d7c1e0e commit 222793c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion packages/backend-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@types/cors": "^2.8.6",
"@types/dockerode": "^3.2.1",
"@types/express": "^4.17.6",
"@types/luxon": "^2.0.4",
"archiver": "^5.0.2",
"aws-sdk": "^2.840.0",
"compression": "^1.7.4",
Expand Down Expand Up @@ -90,7 +91,6 @@
"@types/concat-stream": "^1.6.0",
"@types/fs-extra": "^9.0.3",
"@types/http-errors": "^1.6.3",
"@types/luxon": "^2.0.4",
"@types/minimist": "^1.2.0",
"@types/mock-fs": "^4.13.0",
"@types/morgan": "^1.9.0",
Expand Down
25 changes: 11 additions & 14 deletions packages/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,39 +22,38 @@
* Happy hacking!
*/

import Router from 'express-promise-router';
import {
CacheManager,
createServiceBuilder,
DatabaseManager,
getRootLogger,
loadBackendConfig,
notFoundHandler,
DatabaseManager,
SingleHostDiscovery,
TaskManager,
UrlReaders,
useHotMemoize,
} from '@backstage/backend-common';
import { Config } from '@backstage/config';
import Router from 'express-promise-router';
import { metricsHandler, metricsInit } from './metrics';
import app from './plugins/app';
import healthcheck from './plugins/healthcheck';
import { metricsInit, metricsHandler } from './metrics';
import auth from './plugins/auth';
import azureDevOps from './plugins/azure-devops';
import badges from './plugins/badges';
import catalog from './plugins/catalog';
import codeCoverage from './plugins/codecoverage';
import graphql from './plugins/graphql';
import healthcheck from './plugins/healthcheck';
import jenkins from './plugins/jenkins';
import kafka from './plugins/kafka';
import kubernetes from './plugins/kubernetes';
import proxy from './plugins/proxy';
import kafka from './plugins/kafka';
import rollbar from './plugins/rollbar';
import scaffolder from './plugins/scaffolder';
import proxy from './plugins/proxy';
import search from './plugins/search';
import techdocs from './plugins/techdocs';
import techInsights from './plugins/techInsights';
import todo from './plugins/todo';
import graphql from './plugins/graphql';
import app from './plugins/app';
import badges from './plugins/badges';
import jenkins from './plugins/jenkins';
import { PluginEnvironment } from './types';

function makeCreateEnv(config: Config) {
Expand All @@ -65,15 +64,13 @@ function makeCreateEnv(config: Config) {
root.info(`Created UrlReader ${reader}`);

const databaseManager = DatabaseManager.fromConfig(config);
const taskManager = TaskManager.fromConfig(config);
const cacheManager = CacheManager.fromConfig(config);

return (plugin: string): PluginEnvironment => {
const logger = root.child({ type: 'plugin', plugin });
const database = databaseManager.forPlugin(plugin);
const tasks = taskManager.forPlugin(plugin);
const cache = cacheManager.forPlugin(plugin);
return { logger, cache, database, tasks, config, reader, discovery };
return { logger, cache, database, config, reader, discovery };
};
}

Expand Down
6 changes: 2 additions & 4 deletions packages/backend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,19 @@
* limitations under the License.
*/

import { Logger } from 'winston';
import { Config } from '@backstage/config';
import {
PluginCacheManager,
PluginDatabaseManager,
PluginEndpointDiscovery,
PluginTaskManager,
UrlReader,
} from '@backstage/backend-common';
import { Config } from '@backstage/config';
import { Logger } from 'winston';

export type PluginEnvironment = {
logger: Logger;
cache: PluginCacheManager;
database: PluginDatabaseManager;
tasks: PluginTaskManager;
config: Config;
reader: UrlReader;
discovery: PluginEndpointDiscovery;
Expand Down

0 comments on commit 222793c

Please sign in to comment.