Added support for the new backend system for the entity feedback plugin

Signed-off-by: Niklas Aronsson <niklasar@axis.com>
This commit is contained in:
Niklas Aronsson
2023-06-20 21:40:56 +02:00
parent 07e8526b30
commit 5c1c10adac
9 changed files with 85 additions and 0 deletions
@@ -20,3 +20,4 @@
* @packageDocumentation
*/
export * from './service/router';
export { entityFeedbackPlugin } from './plugin';
@@ -0,0 +1,52 @@
/*
* Copyright 2023 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { loggerToWinstonLogger } from '@backstage/backend-common';
import {
coreServices,
createBackendPlugin,
} from '@backstage/backend-plugin-api';
import { createRouter } from './service/router';
/**
* The Entity Feedback backend plugin.
*
* @public
*/
export const entityFeedbackPlugin = createBackendPlugin({
pluginId: 'entity-feedback',
register(env) {
env.registerInit({
deps: {
discovery: coreServices.discovery,
database: coreServices.database,
identity: coreServices.identity,
logger: coreServices.logger,
httpRouter: coreServices.httpRouter,
},
async init({ database, discovery, identity, logger, httpRouter }) {
httpRouter.use(
await createRouter({
database,
discovery,
identity,
logger: loggerToWinstonLogger(logger),
}),
);
},
});
},
});