Merge pull request #20002 from zcason/zcason/graphql-backend-plugin
Add support to graphql and playlist for the new backend
This commit is contained in:
@@ -85,3 +85,20 @@ export default async function createPlugin(env: PluginEnvironment): Promise<Rout
|
||||
policy: new BackstagePermissionPolicy(),
|
||||
...
|
||||
```
|
||||
|
||||
### New Backend System
|
||||
|
||||
The Playlist backend plugin has support for the [new backend system](https://backstage.io/docs/backend-system/), here's how you can set that up:
|
||||
|
||||
In your `packages/backend/src/index.ts` make the following changes:
|
||||
|
||||
```diff
|
||||
import { createBackend } from '@backstage/backend-defaults';
|
||||
|
||||
const backend = createBackend();
|
||||
|
||||
backend.add(import('@backstage/plugin-playlist-backend'));
|
||||
// ... other feature additions
|
||||
|
||||
backend.start();
|
||||
```
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
import { BackendFeature } from '@backstage/backend-plugin-api';
|
||||
import { BackstageIdentityResponse } from '@backstage/plugin-auth-node';
|
||||
import { ConditionalPolicyDecision } from '@backstage/plugin-permission-common';
|
||||
import { Conditions } from '@backstage/plugin-permission-node';
|
||||
@@ -80,6 +81,10 @@ export const playlistConditions: Conditions<{
|
||||
>;
|
||||
}>;
|
||||
|
||||
// @public
|
||||
const playlistPlugin: () => BackendFeature;
|
||||
export default playlistPlugin;
|
||||
|
||||
// @public (undocumented)
|
||||
export interface RouterOptions {
|
||||
// (undocumented)
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/backend-common": "workspace:^",
|
||||
"@backstage/backend-plugin-api": "workspace:^",
|
||||
"@backstage/catalog-client": "workspace:^",
|
||||
"@backstage/catalog-model": "workspace:^",
|
||||
"@backstage/config": "workspace:^",
|
||||
|
||||
@@ -26,3 +26,4 @@ export {
|
||||
isPlaylistPermission,
|
||||
playlistConditions,
|
||||
} from './permissions';
|
||||
export { playlistPlugin as default } from './plugin';
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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 {
|
||||
coreServices,
|
||||
createBackendPlugin,
|
||||
} from '@backstage/backend-plugin-api';
|
||||
import { createRouter } from './service';
|
||||
import { loggerToWinstonLogger } from '@backstage/backend-common';
|
||||
|
||||
/**
|
||||
* Playlist backend plugin
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const playlistPlugin = createBackendPlugin({
|
||||
pluginId: 'playlist',
|
||||
register(env) {
|
||||
env.registerInit({
|
||||
deps: {
|
||||
http: coreServices.httpRouter,
|
||||
logger: coreServices.logger,
|
||||
database: coreServices.database,
|
||||
identity: coreServices.identity,
|
||||
discovery: coreServices.discovery,
|
||||
permissions: coreServices.permissions,
|
||||
},
|
||||
async init({ http, logger, database, identity, discovery, permissions }) {
|
||||
http.use(
|
||||
await createRouter({
|
||||
logger: loggerToWinstonLogger(logger),
|
||||
database,
|
||||
identity,
|
||||
discovery,
|
||||
permissions,
|
||||
}),
|
||||
);
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user