Socket
Book a DemoInstallSign in
Socket

@mia-platform/backstage-plugin-backend

Package Overview
Dependencies
Maintainers
4
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mia-platform/backstage-plugin-backend

1.1.2
latest
Source
npmnpm
Version published
Weekly downloads
10
233.33%
Maintainers
4
Weekly downloads
 
Created
Source

Mia-Platform Backstage Plugin Backend

@mia-platform/backstage-plugin-backend is a plugin for the Backstage backend app. It updates and inserts on the catalog of your Backstage application all the entities that can be found on your Mia-Platform console such as components, resources, systems etc. It also displays all these information on a dedicated page of the plugin.

Requirements

This plugin requires @mia-platform/backstage-plugin-frontend to display all the information retrieved by the backend plugin on a dedicated page.

Configuration

New backend system

  • Install the plugin to your Backstage app:
yarn workspace backend add @mia-platform/backstage-plugin-backend
  • In packages/backend/src/index.ts import the plugin and add it to the backend:
import miaPlatformModule from '@mia-platform/backstage-plugin-backend';

// ...

backend.add(import('@backstage/plugin-catalog-backend-module-scaffolder-entity-model'));
backend.add(import('@backstage/plugin-catalog-backend/alpha'));

// ...

backend.add(miaPlatformModule());
  • Add to your app-config.yaml file the section for the configuration of support button and the Mia-Platform console

Under app add the configuration for the support button

support:
    url: https://github.com/mia-platform/backstage-plugin/blob/main/README.md
    items: 
      - title: Documentation
        icon: docs
        links:
          - url: https://github.com/mia-platform/backstage-plugin/blob/main/README.md
            title: Repository

And then the configuration for the Mia-Platform console:

miaPlatform:
  baseUrl: ...
  gitBaseUrl: ...
  authorizations:
    - authMode: 'BASIC'
      clientId: ...
      clientSecret: ...
      companyId: ...
    - authMode: 'JWT'
      clientId: ...
      kid: ...
      privateKeyPath: ...
      expirationTime: ...
      companyId: ...
  • baseUrl: Mia Platform console url
  • authorizations: array of service accounts to use to retrieve projects information

Legacy backend system

  • Install the plugin to your Backstage app:
yarn workspace backend add @mia-platform/backstage-plugin-backend
  • Create a new file packages/backend/src/plugins/mia-platform.ts with content:
import { MiaPlatformEntityProvider, createRouter } from '@mia-platform/backstage-plugin-backend/legacy';
import { Router } from 'express';
import { PluginEnvironment } from '../types';
import { CatalogBuilder, CatalogEnvironment } from '@backstage/plugin-catalog-backend';
import { ScaffolderEntitiesProcessor } from '@backstage/plugin-catalog-backend-module-scaffolder-entity-model';

export default async function createPlugin(
  env: PluginEnvironment,
  catalogEnv: CatalogEnvironment
): Promise<Router> {
  const builder = await CatalogBuilder.create(catalogEnv);

  builder.addProcessor(new ScaffolderEntitiesProcessor());

  const miaPlatformProvider = MiaPlatformEntityProvider.create(env.config, env.logger);
  builder.addEntityProvider(miaPlatformProvider);

  const { processingEngine } = await builder.build();

  await processingEngine.start();

  return await createRouter({
    logger: env.logger,
    miaPlatformEntityProvider: miaPlatformProvider,
  });
}
  • In packages/backend/src/index.ts import the plugin and add the route to the plugin:
import miaPlatform from './plugins/mia-platform'

// ...

const miaPlatformEnv = useHotMemoize(module, () => createEnv('mia-platform'));

// ...

apiRouter.use('/mia-platform', await miaPlatform(miaPlatformEnv, catalogEnv));
  • Add to your app-config.yaml file the section for the configuration of support button and the Mia-Platform console

Under app add the configuration for the support button

support:
    url: https://github.com/mia-platform/backstage-plugin/blob/main/README.md
    items: 
      - title: Documentation
        icon: docs
        links:
          - url: https://github.com/mia-platform/backstage-plugin/blob/main/README.md
            title: Repository

And then the configuration for the Mia-Platform console:

miaPlatform:
  baseUrl: ...
  gitBaseUrl: ...
  authorizations:
    - authMode: 'BASIC'
      clientId: ...
      clientSecret: ...
      companyId: ...
    - authMode: 'JWT'
      clientId: ...
      kid: ...
      privateKeyPath: ...
      expirationTime: ...
      companyId: ...
  • baseUrl: Mia Platform console url

[!WARNING] The base URL must not end with a /

  • authorizations: array of service accounts to use to retrieve projects information

Authorization

The authorization elements inside the array should match one of the following:

BASIC
  • authMode: 'BASIC'
  • clientId: clientId used by the service account
  • clientSecret: clientSecret used by the service account
  • companyId: companyId related to the service account
JWT
  • authMode: 'JWT'
  • clientId: clientId used by the service account
  • kid: kid related to the service account to use
  • privateKeyPath: path to the file with the private key
  • companyId: companyId related to the service account

FAQs

Package last updated on 20 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.