npm

@hashicorp/plugin-hcp-consul-backend
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

@hashicorp/plugin-hcp-consul-backend

A backend for HCP Consul, this plugin exposes a services with routes that are used by the @hashicorp/plugin-hcp-consul plugin to query HCP Consul overview and service instances using HCP Consul Central public APIs.

Set Up

  1. Install the plugin using:
# From your Backstage root directory
yarn add --cwd packages/backend @hashicorp/plugin-hcp-consul-backend
  1. Create a hcp-consul-backend.ts file inside packages/backend/src/plugins/:
import { createRouter } from '@hashicorp/plugin-hcp-consul-backend';
import { Router } from 'express';
import { PluginEnvironment } from '../types';

export default async function createPlugin(
  env: PluginEnvironment,
): Promise<Router> {
  return await createRouter(env);
}
  1. Modify your packages/backend/src/index.ts to include:
 ...

 import { Config } from '@backstage/config';
 import app from './plugins/app';
+import consul from './plugins/hcp-consul-backend';
 ...

 async function main() {
   ...

   const authEnv = useHotMemoize(module, () => createEnv('auth'));
+  const consulBackendEnv = useHotMemoize(module, () => createEnv('consul'));
   ...

   const apiRouter = Router();
   apiRouter.use('/catalog', await catalog(catalogEnv));
+  apiRouter.use('/hcp-consul-backend', await consul(consulBackendEnv));

Note: for this backend to work, the consul configuration described in the README of @hashicorp/plugin-hcp-consul must be implemented.

Package Sidebar

Install

npm i @hashicorp/plugin-hcp-consul-backend

Weekly Downloads

8

Version

0.1.3

License

MPL-2.0

Unpacked Size

28.9 kB

Total Files

5

Last publish

Collaborators

  • gstewart-hashi
  • prestonbourne
  • mikegolus
  • leahmariebush
  • kaitlynnefuery
  • abhishek-hashicorp
  • cameronperera
  • alexju
  • consul-ui-services
  • hashicb
  • britt.lindgren
  • paulhcp
  • nandereck
  • tstormk
  • hashibot-hds
  • lackeyjb1
  • jpogran
  • thrashr888
  • melsumner
  • didoo
  • zchsh
  • hcitsec
  • gregone
  • meirish
  • enmod
  • kaxcode
  • anubhavmishra-hashicorp
  • hashibot-web
  • cstitt-hashi
  • mocohen
  • dhaulagiri