npm.io
1.0.6 • Published 2 years ago

backstage-plugin-opslevel-backend

Licence
Apache-2.0
Version
1.0.6
Deps
18
Size
49 kB
Vulns
1
Weekly
0
Stars
1
DeprecatedThis package is deprecated

Overall npm

OpsLevel Maturity Backend Plugin

Deprecated: please use @opslevel/backstage-maturity-backend

This package has been moved into the opslevel namespace and is accessible from via @opslevel/backstage-maturity-backend.

This plugin, in combination with the frontend plugin, provides automatic, scheduled export functionality of users, groups, and components from Backstage into OpsLevel.

Installation

Step 1

In the root directory of your Backstage installation, run the following command:

yarn add --cwd packages/backend @opslevel/backstage-maturity-backend
Step 2

Create a file called opslevel.ts in the packages/backend/src/plugins subdirectory of your Backstage installation and insert the following contents:

import { Router } from 'express';
import { PluginEnvironment } from '../types';
import { OpsLevelBuilder } from '@opslevel/backstage-maturity-backend';

export default async function createPlugin(
  env: PluginEnvironment,
): Promise<Router> {
  const builder = await OpsLevelBuilder.create(env);
  const router = await builder.build();

  return router;
}
Step 3

Open the index.ts file in the packages/backend/src subdirectory of your Backstage installation with the code editor of your choice.

Step 3.1

Add the following line after the end of the existing import statements:

import opslevel from './plugins/opslevel';
Step 3.2

Add the following statement to the cluster of similar statements near the top of the main() function:

const opslevelEnv = useHotMemoize(module, () => createEnv('opslevel'));
Step 3.3

Add the following statement to the cluster of similar statements a bit further down in the main() function:

apiRouter.use('/opslevel', await opslevel(opslevelEnv));
Step 4

If you haven't done so already when installing the frontend plugin, update your app-config.yaml file to add a proxy for OpsLevel. Replace <your_OpsLevel_API_token> with a token from https://app.opslevel.com/api_tokens.

proxy:
  '/opslevel':
    target: 'https://app.opslevel.com'
    headers:
      X-Custom-Source: backstage
      Authorization: Bearer <your_OpsLevel_API_token>
    allowedHeaders: ['GraphQL-Visibility']

Keywords