vippsas / backstage-azure-resources-backend

A backend plugin to pull information from Azure resource graph
MIT License
9 stars 8 forks source link

Look into supporting the new backend system #4

Open ehrnst opened 1 year ago

ehrnst commented 1 year ago

Backstage core is doing a design change to its backend, which will mean a refactor of this plugin at some point.

https://backstage.io/docs/backend-system/building-plugins-and-modules/migrating/

https://backstage.io/docs/backend-system/building-plugins-and-modules/migrating/

ppiwow-apay commented 5 months ago

any news on that?

ppiwow-apay commented 5 months ago

Tried to make it work in a little bit legacy way and seems that this works but with some hacks like disabling new auth service

azure-resources-backend.ts

import { createRouter } from '@vippsno/plugin-azure-resources-backend';
import { createBackendPlugin } from '@backstage/backend-plugin-api';
import { coreServices } from '@backstage/backend-plugin-api';
import {
    loggerToWinstonLogger,
} from '@backstage/backend-common';

export default createBackendPlugin({
    pluginId: 'azure-resources',
    register(env) {
        env.registerInit({
            deps: {
                config: coreServices.rootConfig,
                logger: coreServices.logger,
                httpRouter: coreServices.httpRouter
            },
            async init({ config, logger, httpRouter }) {
                const winstonLogger = loggerToWinstonLogger(logger);
                httpRouter.use(await createRouter({ config, logger: winstonLogger }));

                httpRouter.addAuthPolicy({
                    path: '/',
                    allow: 'unauthenticated',
                });
            },
        });
    },
});

index.ts

backend.add(import('./plugins/azure-resources-backend'));
davormilutinovic commented 3 months ago

I have created new backend version. please check if this could help https://github.com/davormilutinovic/backstage-azure-resources-backend. It is working for me. Don't have time to create out of original repo both old and new versions but it should not be a huge effort. I have also updated new front end plugin version to go with this one https://github.com/davormilutinovic/backstage-azure-resource-frontend.