npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@janus-idp/backstage-plugin-3scale-backend

v1.5.6

Published

The 3scale Backstage provider plugin synchronizes the 3scale content into the [Backstage](https://backstage.io/) catalog.

Downloads

1,714

Readme

3scale Backstage provider

The 3scale Backstage provider plugin synchronizes the 3scale content into the Backstage catalog.

For administrators

Installation

Run the following command to install the 3scale Backstage provider plugin:

yarn workspace backend add @janus-idp/backstage-plugin-3scale-backend

Configuration

3scale Backstage provider allows configuration of one or multiple providers using the app-config.yaml configuration file of Backstage.

Legacy Backend Procedure

  1. Use a threeScaleApiEntity marker to start configuring the app-config.yaml file of Backstage:

    catalog:
      providers:
        threeScaleApiEntity:
          dev:
            baseUrl: https://<TENANT>-admin.3scale.net
            accessToken: <ACCESS_TOKEN>
            schedule: # optional; same options as in TaskScheduleDefinition
              # supports cron, ISO duration, "human duration" as used in code
              frequency: { minutes: 30 }
              # supports ISO duration, "human duration" as used in code
              timeout: { minutes: 3 }
  2. If installing into the legacy backend, configure the scheduler for the entity provider using one of the following methods:

    • Method 1: If the scheduler is configured inside the app-config.yaml using the schedule config key mentioned previously, add the following code to packages/backend/src/plugins/catalog.ts file:

      /* highlight-add-next-line */
      import { ThreeScaleApiEntityProvider } from '@janus-idp/backstage-plugin-3scale-backend';
      
      export default async function createPlugin(
        env: PluginEnvironment,
      ): Promise<Router> {
        const builder = await CatalogBuilder.create(env);
      
        /* ... other processors and/or providers ... */
        /* highlight-add-start */
        builder.addEntityProvider(
          ThreeScaleApiEntityProvider.fromConfig(env.config, {
            logger: env.logger,
            scheduler: env.scheduler,
          }),
        );
        /* highlight-add-end */
      
        const { processingEngine, router } = await builder.build();
        await processingEngine.start();
        return router;
      }

      NOTE

      If you have made any changes to the schedule in the app-config.yaml file, then restart to apply the changes.


    • Method 2: Add a schedule directly inside the packages/backend/src/plugins/catalog.ts file as follows:

      /* highlight-add-next-line */
      import { ThreeScaleApiEntityProvider } from '@janus-idp/backstage-plugin-3scale-backend';
      
      export default async function createPlugin(
        env: PluginEnvironment,
      ): Promise<Router> {
        const builder = await CatalogBuilder.create(env);
      
        /* ... other processors and/or providers ... */
        /* highlight-add-start */
        builder.addEntityProvider(
          ThreeScaleApiEntityProvider.fromConfig(env.config, {
            logger: env.logger,
            schedule: env.scheduler.createScheduledTaskRunner({
              frequency: { minutes: 30 },
              timeout: { minutes: 3 },
            }),
          }),
        );
        /* highlight-add-end */
      
        const { processingEngine, router } = await builder.build();
        await processingEngine.start();
        return router;
      }

    NOTE

    If both the schedule (hard-coded schedule) and scheduler (app-config.yaml schedule) option are provided in the packages/backend/src/plugins/catalog.ts, the scheduler option takes precedence. However, if the schedule inside the app-config.yaml file is not configured, then the schedule option is used.


New Backend Procedure

  1. If installing into the new backend system, make the same configurations to the app=config.yaml as in the Legacy Backend Installation Procedure. Make sure to configure the schedule inside the app-config.yaml file. The default schedule is a frequency of 30 minutes and a timeout of 3 minutes.

  2. Add the following code to the packages/backend/src/index.ts file:

    const backend = createBackend();
    
    /* highlight-add-next-line */
    backend.add(import('@janus-idp/backstage-plugin-3scale-backend/alpha'));
    
    backend.start();

Troubleshooting

When you start your Backstage application, you can see some log lines as follows:

[1] 2023-02-13T15:26:09.356Z catalog info Discovered ApiEntity API type=plugin target=ThreeScaleApiEntityProvider:dev
[1] 2023-02-13T15:26:09.423Z catalog info Discovered ApiEntity Red Hat Event (DEV, v1.2.0) type=plugin target=ThreeScaleApiEntityProvider:dev
[1] 2023-02-13T15:26:09.620Z catalog info Discovered ApiEntity Red Hat Event (TEST, v1.1.0) type=plugin target=ThreeScaleApiEntityProvider:dev
[1] 2023-02-13T15:26:09.819Z catalog info Discovered ApiEntity Red Hat Event (PROD, v1.1.0) type=plugin target=ThreeScaleApiEntityProvider:dev
[1] 2023-02-13T15:26:09.819Z catalog info Applying the mutation with 3 entities type=plugin target=ThreeScaleApiEntityProvider:dev