Simple plugin that proxies requests to the Rollbar API.
- Install the plugin using:
# From your Backstage root directory
yarn --cwd packages/backend add @backstage-community/plugin-rollbar-backend
- In your
packages/backend/src/index.ts
make the following changes:
import { createBackend } from '@backstage/backend-defaults';
const backend = createBackend();
// ... other feature additions
+ backend.add(import('@backstage-community/plugin-rollbar-backend'));
// ...
backend.start();
- Install the plugin using:
# From your Backstage root directory
yarn --cwd packages/backend add @backstage-community/plugin-rollbar-backend
- Create a
rollbar.ts
file insidepackages/backend/src/plugins/
:
import { createRouter } from '@backstage-community/plugin-rollbar-backend';
import { Router } from 'express';
import { PluginEnvironment } from '../types';
export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
return await createRouter({
logger: env.logger,
config: env.config,
});
}
- Modify your
packages/backend/src/index.ts
to include:
...
import { Config } from '@backstage/config';
import app from './plugins/app';
+import rollbar from './plugins/rollbar';
import scaffolder from './plugins/scaffolder';
...
async function main() {
...
const authEnv = useHotMemoize(module, () => createEnv('auth'));
+ const rollbarEnv = useHotMemoize(module, () => createEnv('rollbar'));
const proxyEnv = useHotMemoize(module, () => createEnv('proxy'));
...
const apiRouter = Router();
apiRouter.use('/catalog', await catalog(catalogEnv));
+ apiRouter.use('/rollbar', await rollbar(rollbarEnv));
apiRouter.use('/scaffolder', await scaffolder(scaffolderEnv));
The following values are read from the configuration file.
rollbar:
accountToken: ${ROLLBAR_ACCOUNT_TOKEN}
NOTE: The ROLLBAR_ACCOUNT_TOKEN
environment variable must be set to a read
access account token.