hapi-azure-msi-vault-plugin

0.0.2 • Public • Published

About hapi-azure-msi-vault-plugin

Tested successfully against Azure with Hapi v18.

Build Status

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/

Usage:

'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://<<YOUR VAULT HERE>>.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:

server.app.vault('myAppSecret', 'myAppSecretVersion').then(secret => {
    console.log('secret: ', secret)
});

Package Sidebar

Install

npm i hapi-azure-msi-vault-plugin

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

3.93 kB

Total Files

5

Last publish

Collaborators

  • visualjeff