An open API service indexing awesome lists of open source software.

https://github.com/visualjeff/hapi-azure-msi-vault-plugin

A Hapi v18 Azure MSI Vault plugin
https://github.com/visualjeff/hapi-azure-msi-vault-plugin

azure hapi identities managed msi plugin vault

Last synced: about 1 month ago
JSON representation

A Hapi v18 Azure MSI Vault plugin

Awesome Lists containing this project

README

          

## About hapi-azure-msi-vault-plugin

Tested successfully against Azure with Hapi v18.

[![Build Status](https://travis-ci.org/visualjeff/hapi-azure-msi-vault-plugin.png)](https://travis-ci.org/visualjeff/hapi-azure-msi-plugin)

## Install:
```
npm install hapi-azure-msi-vault-plugin --save
```

## Prerequistes:

Setup an Azure Vault:

[https://azure.microsoft.com/en-us/resources/samples/key-vault-node-getting-started/](https://azure.microsoft.com/en-us/resources/samples/key-vault-node-getting-started/)

## Usage:

```js
'use strict';

const Hapi = require('@hapi/hapi');

const server = new Hapi.Server({
host: '0.0.0.0',
port: process.env.PORT || 1337
});

const startup = async () => {
await server.register([
{
plugin: require('hapi-azure-msi-vault-plugin'),
options: {
kvUri: 'https://<>.vault.azure.net/'
}
}
]);
await server.start();
};

startup().catch((err) => {
throw err;
});

console.log(`${new Date()}: server running at ${server.info.uri}`);
```

## How to fetch a secret:
```js
server.app.vault('myAppSecret', 'myAppSecretVersion').then(secret => {
console.log('secret: ', secret)
});
```